|
-
Sep 9th, 2008, 08:54 PM
#1
Thread Starter
Hyperactive Member
[3.0/LINQ] Double Click Listbox
Hi, im trying to make a listbox Selects it items when the users doubleclicks over the item, but so far i cant get it done, can someone tell me how to do this ??
thanks
-
Sep 10th, 2008, 08:49 PM
#2
Hyperactive Member
Re: [3.0/LINQ] Double Click Listbox
I hope i don't misunderstand your question, but is it that you're displaying items in a listbox and when the user clicks on an item, select and display the item that was selected? If so then:
Let's say we have a listbox named lst1
Code:
// add some items to listbox lst1
lst1.Items.Add("monday");
lst1.Items.Add("tuesday");
lst1.Items.Add("wednesday");
lst1.Items.Add("friday");
The event handler behind the list box:
private void lst1_SelectedIndexChanged(object sender, EventArgs e)
{
MessageBox.Show(lst1.SelectedItem.ToString());
}
Jennifer.
-
Sep 11th, 2008, 07:11 PM
#3
Thread Starter
Hyperactive Member
Re: [3.0/LINQ] Double Click Listbox
I want that to happend when the user double clicks the Item,
-
Sep 11th, 2008, 09:16 PM
#4
Re: [3.0/LINQ] Double Click Listbox
CSharp Code:
private void ListBox1_MouseDoubleClick(object sender, MouseEventArgs e) { if(this.ListBox1.IndexFromPoint(e.Location) != ListBox.NoMatches) { MessageBox.Show(this.ListBox1.GetItemText(this.ListBox1.SelectedItem)); } }
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|