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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autopopulating from a database

Status
Not open for further replies.

perltk07

Programmer
Apr 2, 2007
13
US
I have a form in which there is one combo box and three text boxes:

Combo Box:
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.

Thank you
 
Actually it is not multi coloumned

it looks like the following:

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

If Item A is selected then

TextBox1:
TextBox2:
TextBox3:

Will be filled out with items that link to the Combo Box
 
So the text boxes 1, 2 and 3 are filled out on selecting an item from the combo box
 
Please supply the Source for the drop down to the Combo Box and explictly advise where the data is sourced for the text boxes.

Ta
 
Its a query that i run on a database that fills up the combo box and the text boxes:

here is my code:

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.TEST_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.AutodbDataSet.TEST_PLAN)

End Sub
End Class
 
If Textbox1 is populated with the value from the combo box. Where is textbox2 populated from?
 
All the text boxes are populated from the combo box
 
Since you have populated your combobox, the code to update the textbox once the combox has been updated with a value from the dropdown is as follows:-

Code:
    Private Sub Combobox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Combobox.TextChanged

        Me.Textbox1.Text = Me.Combobox.Text

    End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top