Click to See Complete Forum and Search --> : Populating text boxes from Access DB automatically??


jen.browning
April 24th, 2006, 10:40 AM
I need help with this one. I have a windows form that upon startup, loads one field from an Access DB automatically into a combo box, then displays the corresponding fields for that record in labels. What I would like is for the labels to change when the user changes the combo box (using the drop-down feature). Right now it's throwing an exception error which I copied below:
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in system.data.dll

Additional information: An OleDbParameter with ParameterName 'BusinessName' is not contained by this OleDbParameterCollection.

I know that I need to add code behind the combo box to handle the selection of other entries but I am not sure how to do this. Any help you can offer is appreciated.I have attached my program to this thread.

Thanks!

aniskhan
April 25th, 2006, 05:28 PM
Just bind the combobox and textbox with the dataset during the load event(when u fill the data into dataset)
Me.ComboBox1.DataSource = ds.Tables(0)
Me.ComboBox1.DisplayMember = "rno"
TextBox1.DataBindings.Add("text", ds.Tables(0), "name")