Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo data to text box

Status
Not open for further replies.

cwalshe

Programmer
May 28, 2001
84
0
0
IE
Hi there,

I have a combo box with various entries. I wish to ask the end user to select five entries and to have these entries populate five different text boxes. I also hope to have these text boxes ordered sequentially so that the first selction the user makes fills out the first text box, etc.

Any ideas?

Thx,

Cormac.
 
Private Sub Combo1_Click()
txtText1.text = Combo1.text
end sub

do the same for each combo/text box number
 
What you could do is on the click event of the combo box, check if text1 is empty, if its empty fill it with combo1.text, if it is not empty, then check text2, if its empty fill it, if its not goto next text box...etc

Private Sub Combo1_Click()
If Text1.Text & "" = "" Then
Text1.Text = Combo1.Text
Else
If Text2.Text & "" = "" Then
Text2.Text = Combo1.Text
Else
If Text3.Text & "" = "" Then
Text3.Text = Combo1.Text
Else
If Text4.Text & "" = "" Then
Text4.Text = Combo1.Text
Else
If Text5.Text & "" = "" Then
Text5.Text = Combo1.Text
End If
End If
End If
End If
End If

End Sub
not the fastest way but would work

Adam
 
You could make the 5 textboxes a control array and do the following:

public iIndex as integer

Private Sub Combo1_Click()
txtText(iIndex).text = Combo1.text
iIndex = iIndex + 1
end sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top