Combo Box contents into a text box field
Hi all
I have 3 combo boxes that users select data, i want to pass the selected data to a text box, as this text box then encodes to a bar code,
I can manually type in the text box and the bar code works, I just need to pass the data from the combo boxes to the text boxes.
Is this the correct way to do it or am i way of the mark.
Thanks in advance
Ant
Re: Combo Box contents into a text box field
Do you want this value 'passed' only when there is a selection made in all 3 boxs?
Re: Combo Box contents into a text box field
yes or can be a button to pass the 3 selections many thanks
Re: Combo Box contents into a text box field
There are many ways you could get there. This example assumes DropStyle of DropDown where the user can type a value, but will handle the selected dropdown text change also
Code:
Private Sub ComboBox1_SelectedValueChanged(sender As Object, e As EventArgs) Handles ComboBox1.TextChanged,
ComboBox2.TextChanged,
ComboBox3.TextChanged
If Not String.IsNullOrEmpty(ComboBox1.Text) AndAlso
Not String.IsNullOrEmpty(ComboBox2.Text) AndAlso
Not String.IsNullOrEmpty(ComboBox3.Text) Then
TextBox1.Text = ComboBox1.Text & ComboBox2.Text & ComboBox3.Text
Else
TextBox1.Clear()
End If
End Sub
you could modify this into a button click easy enough