On my Winforms app, I have a primary form with a DataGridView bound to a database Entity datasource.
The grid is set up not to allow inserts. Instead I have a button on my form that kicks of a second dialog where the insert takes place (ie. with friendlier ui than is possible with the DataGridView).
The insert is working fine.. query of the underlying table in db shows that the record has been inserted. However, I can't seem to get the DataGridView on the primary form to see the new data just created by the second dialog.
I have read many Stack Overflow q & a's and tried various solutions to get the DataGridView to refresh to show new data.. but nothing works.
This must be a common situation ?? Can someone suggest some VB.NET code that will work ?
Thanks,
Bazza
Dim qry = From o In mDB.tblFOMTestResults From p In mDB.tblProduct.DefaultIfEmpty _
From c In mDB.tblCalibration _
Where o.ProductID = p.ID And o.CalibrationID = c.ID _
Order By o.RunDate, p.ProductName Select _
o.ID, o.SampleCode, o.RunDate, o.ConditioningDays, o.ConditioningRHAndTemp, _
o.TestArea, o.EdgeSeal, o.SealedBags, o.FaceSeal, _
o.MoisturePercentage, o.CalibrationID, o.FYFOMH1, o.FYFOMH2, o.FYFOMH3, _
o.FYFOMH4, p.ProductName, o.ProductID
Me.TblFOMTestResultsDataGridView.DataSource = qry