CheckedListBox set from file

longbow2000

New member
Joined
Jul 30, 2009
Messages
4
Programming Experience
Beginner
I am an ad-hoc VB application writer to ease my day to day office activities. I started with VB6 and now using VB.net 2005.

I have a CheckedListBox (chkList01) with 130 items. By default all items are checked. Every 5min would like chkList01 to refer to a text file (list.txt) and update the checked state. The list.txt file will have a value per line (True or False) for all 130 lines. An external application will update the list.txt file every 5min.

So every 5min my application will refer to the list.txt file, and row by row see if the value of the row is true or false. If the row value is false then it will change chkList01’s checked state to false.

It will be greatly appreciated if you can assist me with some VB code.

Thanks in advance.
 
VB.NET:
Expand Collapse Copy
Dim values() As String = IO.File.ReadAllLines("chkdata.txt")
For i As Integer = 0 To values.Count - 1
    Me.CheckedListBox1.SetItemChecked(i, CBool(values(i)))
Next
 
Back
Top