Hi,
You are creating a new main form and setting the datasource for
the datagrid on the new form which you have not shown yet. You need to pass
a reference to the main form when you open the second form so you can update
the form you are seeing.
Ken
---------------------
[quoted text, click to view] "Mike Dole" <m_doolio@hotmail.com> wrote in message
news:fddbbab7.0408200646.7da2e615@posting.google.com...
I've got 2 forms:
1 main form with a datagrid (dgCurOrder) and one small form for
OrderEntry
When the user adds a record to the datatable
(OrderDs.Tables("orderregels"))
the record's added I can update the underlying access database with
the dataadapter.
But I cannot refresh the datagrid (dgCurOrder) on my other form...
The datagrid is bound to the above dataset, I can tell that the
records are added, etc, etc.
Here's a snippet:
Private Sub VoegOrderregelToe()
Dim rowVals(4) As Object
Dim rc As DataRowCollection
Dim myNewRow As DataRow
rc = OrderDs.Tables("orderregels").Rows
rowVals(0) = MyDebiteur
rowVals(1) = txtItem.Text 'Artikel
rowVals(2) = txtAantal.Text 'Aantal
rowVals(3) = MyOrderEntryNr 'OrderEntry
rowVals(4) = lblDescription.Text 'Omschrijving
' Add and return the new row.
myNewRow = rc.Add(rowVals)
Dim MyForm As New frmCurOrder 'This is the main form
myOrderRegelAdapter.Update(OrderDs, "orderregels")
MyForm.dgCurOrder.DataSource = OrderDs.Tables("orderregels")
MyForm.dgCurOrder.Refresh()
End Sub
Thanks in advance!
Mike