|
-
Apr 2nd, 2010, 08:34 AM
#1
Re: How to choose a ListBox itemdata other than zero???
Code:
Option Explicit
Private Sub Form_Load()
'~~~ Loading sample datas
List1.AddItem "Contains 1"
List1.ItemData(List1.NewIndex) = 1
List1.AddItem "Contains 2"
List1.ItemData(List1.NewIndex) = 2
List1.AddItem "Contains 0"
List1.ItemData(List1.NewIndex) = 0
List1.AddItem "Contains 4"
List1.ItemData(List1.NewIndex) = 4
List1.AddItem "Contains 0"
List1.ItemData(List1.NewIndex) = 0
End Sub
Private Sub List1_Click()
If List1.ItemData(List1.ListIndex) <> 0 Then '~~~ Check if the ItemData of selected item is not 0
MsgBox "Congratulations !" '~~~ If so, display the message
Unload Me '~~~ Close the form
End If
End Sub
...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
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
|