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

Loading data into a combo box

Status
Not open for further replies.

CookieNZ

MIS
Apr 22, 2002
48
0
0
NZ
Behing the form load sub,I populate some text and combo boxes with data:-

cmbstatus.DataBindings.Add("Text", dssupport.Tables("Supportcall"), "Status")
txtoperator.DataBindings.Add("Text", dssupport.Tables("Supportcall"), "Operator")

The text fields are populated correctly with the data from the record, yet the combo boxes fields do not display the correct data.

I know I have bound the data correctly because I can select from the drop down combo when creating a new record.

 
OK I'm lost at first you say it is not working then at the end you say it is working.

How is the combo box different in adding a record than what ever you are doing in the beginning?
 
I have just realised what I have stupidly done. In the form load procedure, I was asking it to fill the combo box AND be populated with the data from the record! Thanks anyway.
 
Further to the above I now know what my issue is.

When I am navigating through records, the combo box is correctly populated with data from the record.

However, I need to allow the user to change the setting in the combo box upon edit.

When I fill the combo box with the setting options, it loses the original setting that the record was saved with.

How can I do both e.g. keep the original setting, but still load with options? I have tried to fill the combo on selectindexchanged, but to no avail.
 
Having dug around, using the 'Handles cmbstatus.dropdown' for a combo box sub, I can do what I need it do

Private Sub cmbstatus_focus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbstatus.DropDown

statusadapter.Fill(Statusds, "Callstatus")

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top