Click here to Skip to main content
15,900,108 members
Home / Discussions / C#
   

C#

 
QuestionClient-Server [modified] Pin
Aamu6-Oct-07 1:05
Aamu6-Oct-07 1:05 
QuestionThreading Pin
udikantz6-Oct-07 0:46
udikantz6-Oct-07 0:46 
AnswerRe: Threading Pin
lmoelleb6-Oct-07 1:00
lmoelleb6-Oct-07 1:00 
GeneralRe: Threading Pin
udikantz6-Oct-07 1:52
udikantz6-Oct-07 1:52 
GeneralRe: Threading Pin
lmoelleb6-Oct-07 3:35
lmoelleb6-Oct-07 3:35 
GeneralRe: Threading Pin
udikantz6-Oct-07 6:16
udikantz6-Oct-07 6:16 
Questionhow to check the files are exist or not in a floder Pin
ramyanaidu5-Oct-07 22:45
ramyanaidu5-Oct-07 22:45 
AnswerRe: how to check the files are exist or not in a floder Pin
Hessam Jalali5-Oct-07 23:03
Hessam Jalali5-Oct-07 23:03 
AnswerRe: how to check the files are exist or not in a floder Pin
Abhijit Jana5-Oct-07 23:52
professionalAbhijit Jana5-Oct-07 23:52 
QuestionCancelling a background worker Pin
Muammar©5-Oct-07 22:40
Muammar©5-Oct-07 22:40 
AnswerRe: Cancelling a background worker Pin
Hessam Jalali6-Oct-07 0:19
Hessam Jalali6-Oct-07 0:19 
GeneralRe: Cancelling a background worker Pin
Muammar©6-Oct-07 0:39
Muammar©6-Oct-07 0:39 
GeneralRe: Cancelling a background worker Pin
Hessam Jalali6-Oct-07 1:00
Hessam Jalali6-Oct-07 1:00 
GeneralRe: Cancelling a background worker Pin
Muammar©6-Oct-07 1:33
Muammar©6-Oct-07 1:33 
QuestionCopying files to clipboard?? Pin
Muammar©5-Oct-07 22:19
Muammar©5-Oct-07 22:19 
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 

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.