Check Box List

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rohit111111
    New Member
    • Mar 2007
    • 48

    #1

    Check Box List

    How can i use CheckBox LISt control in vb.net
  • Rohit111111
    New Member
    • Mar 2007
    • 48

    #2
    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....

    Comment

    • shweta123
      Recognized Expert Contributor
      • Nov 2006
      • 692

      #3
      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 Sub

      Comment

      • Rohit111111
        New Member
        • Mar 2007
        • 48

        #4
        Originally posted by shweta123
        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 Sub
        Thanks Shewta but i am working on web application

        Comment

        Working...