I found the solution. The databounds should be as the following:
InstIdTextBox.DataBindings.Add("Text", bsInstitute, "instId") CodeTextBox.DataBindings.Add("Text", bsInstitute, "code") NameTextBox.DataBindings.Add("Text", bsInstitute, "name") TypeTextBox.DataBindings.Add("Text", bsInstitute, "type")
dataset instead of bsInstitute. But now its perfect. Try
dsOptions = New DataSet
loadOptions()
bsInstitute = New BindingSource(dsOptions, "institute")
InstIdTextBox.DataBindings.Add("Text", bsInstitute, "instId")
CodeTextBox.DataBindings.Add("Text", bsInstitute, "code")
NameTextBox.DataBindings.Add("Text", bsInstitute, "name")
TypeTextBox.DataBindings.Add("Text", bsInstitute, "type")
Catch ex As Exception
MsgBox(Err.Description)
End Try
I was using the dataset for the binding like this
InstIdTextBox.DataBindings.Add("Text", dsOptions.Tables("institute"),"instId")
But whats right I should replace the dsOptions.tables("institute") in the above line of code with the bindingSource I creadted like the following
InstIdTextBox.DataBindings.Add("Text", bsInstitute, "instId")
This way I could use the bindingSource object to navigate records in my dataset.