How can i use CheckBox LISt control in vb.net
Check Box List
Collapse
X
-
Tags: None
-
More Information :
I have a table in database that stores the intrerst of user like Cricket,basketb all,snooker etc. now this interests I have to show with checkbox on a page that a user can select multiple interestes so for the same how can i use checkbox list or any other way to do his
PLease help me.... -
Hi,
Here is the usage of CheckedListBox,
Private Sub Form2_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
''''''''''Adds the item
''''''''''''''' '''''''Here you can also take database field
CheckedListBox1 .Items.Add("Cri cket")
CheckedListBox1 .Items.Add("Sno oker")
''''''''''Remov es the item
CheckedListBox1 .Items.Remove(C heckedListBox1. Items.Item(0))
End Sub
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
''''''''''''''' ''''Gets checked Item Collection
Dim checked_items As CheckedListBox. CheckedItemColl ection = CheckedListBox1 .CheckedItems
For Each checked_item As Object In checked_items
MsgBox(checked_ item)
Next
End SubComment
-
Thanks Shewta but i am working on web applicationOriginally posted by shweta123Hi,
Here is the usage of CheckedListBox,
Private Sub Form2_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
''''''''''Adds the item
''''''''''''''' '''''''Here you can also take database field
CheckedListBox1 .Items.Add("Cri cket")
CheckedListBox1 .Items.Add("Sno oker")
''''''''''Remov es the item
CheckedListBox1 .Items.Remove(C heckedListBox1. Items.Item(0))
End Sub
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
''''''''''''''' ''''Gets checked Item Collection
Dim checked_items As CheckedListBox. CheckedItemColl ection = CheckedListBox1 .CheckedItems
For Each checked_item As Object In checked_items
MsgBox(checked_ item)
Next
End SubComment
Comment