Public Sub chklistbox()
Dim dr As DataTable = objdb.getdata("select district_name,district_id from district_master where state_id='" & "9" & "'")
If dr.Rows.Count > 0 Then
CheckedListBox1.DataSource = dr
CheckedListBox1.DisplayMember = "district_name"
CheckedListBox1.ValueMember = "district_id"
CheckedListBox1.Text = Nothing
dr = Nothing
Else
CheckedListBox1.DataSource = Nothing
CheckedListBox1.Text = Nothing
End If
End Sub
when you assign properties value member and display member you can retrieve its value using :
Label9.Text = CheckBoxList1.SelectedItem.ToString()
Label8.Text = CheckedListBox1.SelectedValue.ToString()
Dim dr As DataTable = objdb.getdata("select district_name,district_id from district_master where state_id='" & "9" & "'")
If dr.Rows.Count > 0 Then
CheckedListBox1.DataSource = dr
CheckedListBox1.DisplayMember = "district_name"
CheckedListBox1.ValueMember = "district_id"
CheckedListBox1.Text = Nothing
dr = Nothing
Else
CheckedListBox1.DataSource = Nothing
CheckedListBox1.Text = Nothing
End If
End Sub
when you assign properties value member and display member you can retrieve its value using :
Label9.Text = CheckBoxList1.SelectedItem.ToString()
Label8.Text = CheckedListBox1.SelectedValue.ToString()
No comments:
Post a Comment