A
Adda
I have a datagrid on one form but I add data to the
datasource from another form, using a different dataset
object (but same dataset.xsd) and different adapter than
the adapter for the datagrid form. Is there any syntax
for manipulating the datagrid from the other form? Here
is something I tried that did not reflect any updates in
the datagrid from the second form
Sub AddRec(...)...
Dim dr As datarow, frm As New datagridForm
dr = frm.gridDataset.Tables("tbl1").NewRow
dr(0) = txt0.Text
dr(1) = txt1.Text
frm.gridDataset.Tables("tbl1").Rows.Add(dr)
frm.gridAdapter.Update(frm.gridDataset, "tbl1")
End Sub
This adds a new record to the datasource but it does not
show up in the datagrid on the datagridForm. I had to add
a button to the datagridForm to clear the dataset and
refill it with the gridAdapter on the datagridForm. Then
the new record shows up. I tried clearing and refilling
from the second form but nothing showed up in the
datagrid. Is there a way to control the datagrid from the
second form?
TIA
Adda
datasource from another form, using a different dataset
object (but same dataset.xsd) and different adapter than
the adapter for the datagrid form. Is there any syntax
for manipulating the datagrid from the other form? Here
is something I tried that did not reflect any updates in
the datagrid from the second form
Sub AddRec(...)...
Dim dr As datarow, frm As New datagridForm
dr = frm.gridDataset.Tables("tbl1").NewRow
dr(0) = txt0.Text
dr(1) = txt1.Text
frm.gridDataset.Tables("tbl1").Rows.Add(dr)
frm.gridAdapter.Update(frm.gridDataset, "tbl1")
End Sub
This adds a new record to the datasource but it does not
show up in the datagrid on the datagridForm. I had to add
a button to the datagridForm to clear the dataset and
refill it with the gridAdapter on the datagridForm. Then
the new record shows up. I tried clearing and refilling
from the second form but nothing showed up in the
datagrid. Is there a way to control the datagrid from the
second form?
TIA
Adda