|
-
Feb 4th, 2004, 10:19 AM
#1
Thread Starter
Registered User
listbox doubleclick
how do i create a function that executes when an item in a listbox is double clicked on? it has to be a double click on an item and not anywhere in the listbox. the item index or name has to be passed as an argument of the function.
thanks.
-
Feb 4th, 2004, 10:53 AM
#2
Sleep mode
Simply , like this :
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ListBox1.Items.AddRange(New String() {"marvinklein", "Edneeis", "Pirate"})
End Sub
Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
Dim itm As String = Me.ListBox1.Text
If itm <> "" Then
'Do your stuff here
MsgBox("You doubleclicked " + Me.ListBox1.Text)
Else
Exit Sub
End If
End Sub
-
Feb 4th, 2004, 10:56 AM
#3
Sleep mode
Updated ,
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
Me.ListBox1.Items.AddRange(New String() {"marvinklein", "Edneeis", "Pirate"})
End Sub
Private Sub ListBox1_DoubleClick(ByVal sender As Object,
ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
Dim itm As String = Me.ListBox1.Text
If itm <> "" Then
'Do your stuff here
ShowItem(Me.ListBox1.Text)
[B]Me.ListBox1.SelectedIndex = -1[/B]
Else
Exit Sub
End If
End Sub
Private Sub ShowItem(ByVal item As String)
MessageBox.Show(item)
End Sub
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
|