Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

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

$
0
0

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 can't 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


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>