Click here to Skip to main content
15,884,298 members
Home / Discussions / C#
   

C#

 
AnswerRe: Copying files to clipboard?? Pin
pmarfleet5-Oct-07 22:37
pmarfleet5-Oct-07 22:37 
GeneralRe: Copying files to clipboard?? Pin
Muammar©5-Oct-07 22:53
Muammar©5-Oct-07 22:53 
GeneralRe: Copying files to clipboard?? Pin
User 66586-Oct-07 2:11
User 66586-Oct-07 2:11 
GeneralRe: Copying files to clipboard?? Pin
Muammar©6-Oct-07 11:31
Muammar©6-Oct-07 11:31 
QuestionUsers in local users and groups Pin
Surya Ayyagari5-Oct-07 22:02
Surya Ayyagari5-Oct-07 22:02 
AnswerRe: Users in local users and groups [modified] Pin
Hessam Jalali5-Oct-07 23:57
Hessam Jalali5-Oct-07 23:57 
QuestionSelecting an item in a listbox control Pin
Muammar©5-Oct-07 21:43
Muammar©5-Oct-07 21:43 
AnswerRe: Selecting an item in a listbox control Pin
Hessam Jalali5-Oct-07 23:00
Hessam Jalali5-Oct-07 23:00 
Hi

I suggest to use MouseDown or MouseUp events instead of Click because they give you the mouse button and position all together

and you can find the index of pointed item by using IndexFromPoint method of listBox instance

here is the code I tested to see how it can be done


void listBox1_MouseDown(object sender, MouseEventArgs e)
{
    if (e.Button != MouseButtons.Right) return;

    int index=this.listBox1.IndexFromPoint(e.Location);

    if (index == -1) return;

    object selectedObj = this.listBox1.Items[index];

    // if you want to select that in the list

    this.listBox1.SelectedIndex = index;

    MessageBox.Show(selectedObj.ToString());//just for test
}


good luck Smile | :)
GeneralRe: Selecting an item in a listbox control Pin
Muammar©5-Oct-07 23:17
Muammar©5-Oct-07 23:17 
QuestionGetting error to send mail in asp.net 2.0 Pin
Rajesh Ji5-Oct-07 21:25
Rajesh Ji5-Oct-07 21:25 
AnswerRe: Getting error to send mail in asp.net 2.0 Pin
Christian Graus5-Oct-07 22:35
protectorChristian Graus5-Oct-07 22:35 
AnswerRe: Getting error to send mail in asp.net 2.0 Pin
Vasudevan Deepak Kumar5-Oct-07 23:13
Vasudevan Deepak Kumar5-Oct-07 23:13 
QuestionDelegates Pin
.NET- India 5-Oct-07 21:24
.NET- India 5-Oct-07 21:24 
AnswerRe: Delegates Pin
pmarfleet5-Oct-07 22:12
pmarfleet5-Oct-07 22:12 
AnswerRe: Delegates Pin
Christian Graus5-Oct-07 23:46
protectorChristian Graus5-Oct-07 23:46 
QuestionCopy and Move with FileSystemWatch in C# Pin
Abhijit Jana5-Oct-07 21:11
professionalAbhijit Jana5-Oct-07 21:11 
AnswerRe: Copy and Move with FileSystemWatch in C# Pin
pmarfleet5-Oct-07 22:25
pmarfleet5-Oct-07 22:25 
GeneralRe: Copy and Move with FileSystemWatch in C# Pin
Abhijit Jana6-Oct-07 1:01
professionalAbhijit Jana6-Oct-07 1:01 
AnswerRe: Copy and Move with FileSystemWatch in C# Pin
Dave Kreskowiak6-Oct-07 3:14
mveDave Kreskowiak6-Oct-07 3:14 
QuestionQuestion about Content Pipeline Files.... Pin
MMaines20055-Oct-07 16:22
MMaines20055-Oct-07 16:22 
Question"Or" Pin
MasterSharp5-Oct-07 12:24
MasterSharp5-Oct-07 12:24 
AnswerRe: "Or" Pin
Anthony Mushrow5-Oct-07 12:36
professionalAnthony Mushrow5-Oct-07 12:36 
GeneralRe: "Or" Pin
pmarfleet5-Oct-07 12:56
pmarfleet5-Oct-07 12:56 
GeneralRe: "Or" Pin
MasterSharp5-Oct-07 13:03
MasterSharp5-Oct-07 13:03 
AnswerRe: "Or" Pin
Christian Graus5-Oct-07 13:25
protectorChristian Graus5-Oct-07 13:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.