i have created 3 arrays

asnames - stores names
iages - stores ages
cwages - stores wages

the code is as follows

Dim asnames(5) As String 'general declarations
Dim iages(5) As Integer 'general declarations
Dim cwages(5) As Currency 'general declarations

Private Sub Command1_Click()

Static iposition As Integer

iposition = iposition + 1

asnames(iposition) = Text1.Text
iages(iposition) = Text2.Text
cwages(iposition) = Text3.Text

Open "a:/textfile.txt" For Append As #1
Write #1, asnames(iposition), iages(iposition), cwages(iposition)

Close #1

i can then type in a name and the corresponding age and wage will show up in the relevant textboxes.

The code to do this is as follows..


Private Sub CommandButton2_Click()

Open "a:/textfile.txt" For Input As #1
For icount = 1 To 5


While Not EOF(1)
Input #1, asnames(icount)
Input #1, iages(icount)
Input #1, cwages(icount)

If Text1.Text = asnames(icount) Then
Text2.Text = iages(icount)
Text3.Text = cwages(icount)
End If


Wend
Next icount
Close #1

However , my problem is that i want to be able to dump all the names in to a combo box.

The code i have written to do this is ...

Private Sub CommandButton3_Click()

'to transfer data in asnames variable to combo box.

'put contents of
Open "a:/textfile.txt" For Input As #1
For icount = 1 To 5
While Not EOF(1)
Input #1, asnames(icount)
Combo1.AddItem asnames(icount)

Wend

Next icount
Close #1

However, this does not work properly, as it will transfer all the data in the textfile to the combo box i.e, ages and wages. All i want is to just store the names which are in the string variable
asnames..

Any help would be much appreciated.


sparkash