|
-
Apr 6th, 2005, 04:47 PM
#1
Thread Starter
Lively Member
Double Clicking List Items
Can you make say a msgbox pop up when 1 item in a list is double clicked?
Thanks
-
Apr 6th, 2005, 04:50 PM
#2
Hyperactive Member
Re: Double Clicking List Items
VB Code:
Private Sub List1_DblClick()
msgbox "MESSAGE TO POP UP"
End Sub
Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White
-
Apr 6th, 2005, 04:54 PM
#3
Re: Double Clicking List Items
You may want to time the clicks, but this is the basics.
VB Code:
Option Explicit
Private Sub Form_Load()
List1.AddItem 1
List1.AddItem 2
End Sub
Private Sub List1_Click()
Static clcount
clcount = (clcount + 1)
If clcount = 2 Then Msgbox "Double-Clicked!" : clcount = 0
End Sub
-
Apr 6th, 2005, 05:05 PM
#4
Hyperactive Member
Re: Double Clicking List Items
You may want to time the clicks, but this is the basics.
VB Code:
Option Explicit
Private Sub Form_Load()
List1.AddItem 1
List1.AddItem 2
End Sub
Private Sub List1_Click()
Static clcount
clcount = (clcount + 1)
If clcount = 2 Then Msgbox "Double-Clicked!" : clcount = 0
End Sub
ummm... why do it this complicated? whats wrong with the double click event?
Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White
-
Apr 6th, 2005, 05:06 PM
#5
Thread Starter
Lively Member
Re: Double Clicking List Items
The list data is text and also i want the message box to be different for each list item.. thanks :P
@Arachnid13, im not trying to make it so when someone double clicks the list a message box appears, i want it so when they click a single item (i.e not the whole list) the message box appears.
Cheers
Last edited by BefunMunkToloGen; Apr 6th, 2005 at 05:11 PM.
-
Apr 6th, 2005, 05:16 PM
#6
Re: Double Clicking List Items
VB Code:
Private Sub List1_DblClick()
Msgbox List1.List(List1.Listindex)
End Sub
casey.
-
Apr 6th, 2005, 05:20 PM
#7
Thread Starter
Lively Member
Re: Double Clicking List Items
That works fine, but I want it like this (sorry its late here lol).
On double clicking 1234 it says "Hello"
On double clicking item4 it says "tralala"
1234 and item4 are different items if you know what i mean.
-
Apr 6th, 2005, 05:27 PM
#8
Re: Double Clicking List Items
if you want different for each one then you may have to do a select case
VB Code:
Select Case List1.List(List1.Listindex)
Case "1234"
msgbox "Hello"
Case "something else"
msgbox "tralala"
End Select
if you have a lot of different items then it may be better to put all the answers in a array then call the array like this
VB Code:
Private Sub List1_DblClick()
Msgbox thearray(List1.Listindex)
End Sub
casey.
-
Apr 6th, 2005, 05:33 PM
#9
Thread Starter
Lively Member
Re: Double Clicking List Items
What would i do without you? lol thanks al lot casey and everyone else
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
|