Need to check a checkbox in a checkedlistbox at run time

  • Thread starter Thread starter akunuri.swapna
  • Start date Start date
A

akunuri.swapna

Hi All - I have a checkedListBox in my form. I am adding items to it at
run time. However I also need to check the items depending on a
condition. I have tried a lot but cant get the added item to check.
Here is my code.

Dim objdb As New clsDB
PaymentOptions = objdb.GetPaymentOptionsByProductID
Dim objrowPaymentOptions As DataRow
For Each objrowPaymentOptions In PaymentOptions.Tables(0).Rows
Dim string1 as string =
CType(objrowPaymentOptions.Item("is_default"), String)

checkedListBox1.Items.Add(CType(objrowPaymentOptions.Item("new_item"),
String))
If string1 = "Y" Then
..............Code to check the item added above......

End If
next

I hope you got my question.
Anyone please help.


Thanks
Riaz
 
Hi you can use one of the overloads of the items.add to specify if the item
is checked or not.
checkedListBox1.Items.Add("X",true)

Hope this helps

Greetz Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top