By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,649 Members | 696 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,649 IT Pros & Developers. It's quick & easy.

Autopopulate text boxes after selecting a combo box entry

P: 19
I have a form in which there is one combo box and three text boxes:

Combo Box:
-> Item A
-> Item B
-> Item C

TextBox1:
TextBox2:
TextBox3:

Once an Item is selected from the combo box, the text boxes are autopopulated with the respected fields which link to the items in the combo box.

Its getting the combo and the text boxes from a data base.

Can someone guide me as how to do that?

Write now I have a combo Box with all the items but I dont know how to link the text box fields to the items in the combo box.

So the text boxes 1, 2 and 3 are filled out on selecting an item from the combo box



Thank you
May 7 '07 #1
Share this Question
Share on Google+
2 Replies


P: 47
I have a form in which there is one combo box and three text boxes:

Combo Box:
-> Item A
-> Item B
-> Item C

TextBox1:
TextBox2:
TextBox3:

Once an Item is selected from the combo box, the text boxes are autopopulated with the respected fields which link to the items in the combo box.

Its getting the combo and the text boxes from a data base.

Can someone guide me as how to do that?

Write now I have a combo Box with all the items but I dont know how to link the text box fields to the items in the combo box.

So the text boxes 1, 2 and 3 are filled out on selecting an item from the combo box



Thank you
Yes it can be achieved easily.
Now I have Just Give u the Hints.ok First Try Yourself. if not possible then i will
give u the Details Code.

1)First Populate the Combo in Form Load event.
2)Now write code(searching desire recor) in combo_change event.
a) select the fields that u want to display in textbox through recordset filter by combo.text
b) if recordset recordcount >0 i.e if u will find desire record then show it in the
corrosponding textbox.
May 8 '07 #2

P: 19
Yes it can be achieved easily.
Now I have Just Give u the Hints.ok First Try Yourself. if not possible then i will
give u the Details Code.

1)First Populate the Combo in Form Load event.
2)Now write code(searching desire recor) in combo_change event.
a) select the fields that u want to display in textbox through recordset filter by combo.text
b) if recordset recordcount >0 i.e if u will find desire record then show it in the
corrosponding textbox.

Following is the code I have:

Public Class Form1

'Loads the names of the active cycles in the combobox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'AutodbDataSet1.TEST_PLAN' table. You can move, or remove it, as needed.
' This is the query that is autopopulated
Me.TEST_PLANTableAdapter1.Fill(Me.AutodbDataSet1.T EST_CASE_LINK, TEST_PLANComboBox.Text)
'TODO: This line of code loads data into the 'AutodbDataSet.TEST_PLAN' table. You can move, or remove it, as needed.
' This is the query that loads the cycles
Me.TEST_PLANTableAdapter.FillBytestplan(Me.AutodbD ataSet.TEST_PLAN)

End Sub
End Class

So right now there are multiple enteries in the combo box but the text fields just point to the first one on the database. And dont change when a different entry is selected in the combo box.

Should it be something like "textchange in combo box" then autopopulate the fields with the appropriate items that link to the combo box.

I am new to VB so is it the "cboName_Leave" function or can you help me with the code please.

Thanks
May 8 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.