Hello,
I'm trying to get te index of a specific text in a ComboBox.
The ComboBox is filled by searching for filenames in a directory.
The text of the last item selected in the ComboBox is saved in a
textfile in the OnExit Event of the Mainform.
While loading the Mainform I want the text that was saved in the file
to be compared with the items in the ComboBox ad get the index of the
found item, so that I can set it as selected.
I thought i could do it something like this, but the program hangs
before I can see anything.
---------
Code
---------
Dim i, As Integer
Dim line As String
For i = 0 To ComboBox1.Items .Count
If ComboBox1.Items (i) = line Then
IndexFound = i
Exit For
End If
Next
---------
Code
---------
Can anyone help me please,
Thanx
I'm trying to get te index of a specific text in a ComboBox.
The ComboBox is filled by searching for filenames in a directory.
The text of the last item selected in the ComboBox is saved in a
textfile in the OnExit Event of the Mainform.
While loading the Mainform I want the text that was saved in the file
to be compared with the items in the ComboBox ad get the index of the
found item, so that I can set it as selected.
I thought i could do it something like this, but the program hangs
before I can see anything.
---------
Code
---------
Dim i, As Integer
Dim line As String
For i = 0 To ComboBox1.Items .Count
If ComboBox1.Items (i) = line Then
IndexFound = i
Exit For
End If
Next
---------
Code
---------
Can anyone help me please,
Thanx
Comment