How to assign a variable to a Checkedlistbox

itms

Active member
Joined
Feb 21, 2018
Messages
33
Programming Experience
10+
Hi,

I have a CheckedListBox that I am trying to assign a variable to and it will not go be the code that I know to use(shown below).
I know it is not going because when it opens the form the field is blank. And I checked the variable is populated, and _PID is a global variable.
Any help I would really appreciate.

Thank you

My code:

VB.NET:
  CheckedListBox_PurchaseID.Items.Add(_PID)
            CheckedListBox_PurchaseID.SelectedIndex = 0
 
I found out that this is working, there is something else causing it not to show.
So this is solved.


Thank you
 
What is "_PID" ?
It's also a good to know that adding things to a CheckedListBox, ComboBox, & ListBox will call .ToString() on each item that shows in the list. If you're adding your own class be sure to Override the ToString() function so you can control what text shows in those controls.
 
Back
Top