Using a form that is populated by a binding source to add new datarow.

  • Thread starter Thread starter maxshiner
  • Start date Start date
M

maxshiner

Guest
I have a dataset (AgentsDataset) that fills in the form shown in image below. Once the form is activated and the information fills the combobox and the textboxes the form seems to freeze. I cant even close it using the Cancel Button.

I was under the impression that if I wanted to add a new datarow to my table I could just type in a new name in the combobox (agentname). I am able to type the new name in, but I can not enter the corresponding info in the textboxes.

Is it possible to do what I am trying? I have included an image of the form. I have also included the code. Can someone please help me out? I am new at this, but trying to learn.

Thanks



Public Class Agents

Private Sub AgentsBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles AgentsBindingNavigatorSaveItem.Click
Me.Validate()
Me.AgentsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.AgentsDataSet)

End Sub

Private Sub Agents_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TODO: This line of code loads data into the AgentsDataSet.Agents table. You can move, or remove it, as needed.
Me.AgentsTableAdapter.Fill(Me.AgentsDataSet.Agents)

End Sub

Private Sub CancelButton1_Click(sender As Object, e As EventArgs) Handles CancelButton1.Click
Me.Hide()
MainWindow.Show()
End Sub
End Class



09ecc5742883111ee4b1a1d3dc04df75._.png


Continue reading...
 
Back
Top