-
I have a List Box(List1) and in the properties area the Style is set to 1- Checkbox.
The problem is that I have to check certain items in the check box based on a seperate file that looks something like this:
#TRUE#
#FALSE#
#FALSE#
#FALSE#
#FALSE#
#TRUE#
#FALSE#
The thing is that I have to do this in a list box with about 52 items in it. When the program is started I have to read from a .txt file that when veiwed looks like my original post. I have to read through the file and put a check in the list box next to every one that is True.
-
Try this:
Code:
Dim blnValue as Boolean
Open "MyFile" for Input As #1
Do Until EOF(1)
Input #1, blnValue
List1.AddItem CStr(blnValue)
List1.Selected(List1.NewIndex) = blnValue
Loop
-
That almost worked. My problem is that My list box is already populated before I ever even read in the file. I have to put check marks next to items already in the list box without adding any new items. My list box contains each of the 50 States. Thanks for the help so far, I am one step closer.
-
As you loop thru a listbox, to check a particular item, do something like this:
Code:
For X = 0 To List1.ListCount - 1
If List1.List(X) = "NJ" Or List1.List(X) = "PA" _
Or (whatever) then
List1.Selected(X) = True
End If
Next
-
Thanks for the help. It worked.