I need help in using AddNew() method, with DataGrid.
I have a VB.NET 2008 application, with a DataGrid in it.
I want the user to fill a form with some data. then I want to update the the DataGrid (data base is an Access table) with that data. I use the following code, but it does not enter any new row to my Grid.
Private Sub bindnavGrid_AddNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bindnavGrid_AddNew.Click
Dim oRow As System.Data.DataRowView
Me.CustomersBindingSource.MoveLast()
'Add new record to recordsets
oRow = Me.CustomersBindingSource.AddNew()
oRow.BeginEdit()
With oRow
.Item("PROPOSAL") = sProposal_Number
.Item("CUSTOMER") = sCustomer_Name
.Item("CONTACTOR") = sContractor_Name
End With
oRow.EndEdit()
Me.CustomersBindingSource.EndEdit()
Me.FWQuotationsDataSet.AcceptChanges()
Me.CustomersTableAdapter.Update(Me.FWQuotationsDataSet.Customers)
Me.CustomersTableAdapter.Fill(Me.FWQuotationsDataSet.Customers)
End Sub
I have a VB.NET 2008 application, with a DataGrid in it.
I want the user to fill a form with some data. then I want to update the the DataGrid (data base is an Access table) with that data. I use the following code, but it does not enter any new row to my Grid.
Private Sub bindnavGrid_AddNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bindnavGrid_AddNew.Click
Dim oRow As System.Data.DataRowView
Me.CustomersBindingSource.MoveLast()
'Add new record to recordsets
oRow = Me.CustomersBindingSource.AddNew()
oRow.BeginEdit()
With oRow
.Item("PROPOSAL") = sProposal_Number
.Item("CUSTOMER") = sCustomer_Name
.Item("CONTACTOR") = sContractor_Name
End With
oRow.EndEdit()
Me.CustomersBindingSource.EndEdit()
Me.FWQuotationsDataSet.AcceptChanges()
Me.CustomersTableAdapter.Update(Me.FWQuotationsDataSet.Customers)
Me.CustomersTableAdapter.Fill(Me.FWQuotationsDataSet.Customers)
End Sub