• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 61
  • Last Modified:

Refreshing a Datagrid when information has been updated in another screen

I have a form that opens another form when a button is clicked from a datagridview.  I update the information on the second screen and close it.  I go back to the original screen and try to refresh the data, but it won't load.  I checked the SQL table and the new information is in there.  I have a query to get the new data but it continues to retrieve the original data.  I have tried several ways, this being my latest.

 Me.TblObservationDataGridView.DataSource = Nothing
Me.TblObservationBindingSource.DataSource = Nothing

        Dim getSource = From id In d.tblObservations _
                        Where id.AssID = CStr(Me.cbAssID.SelectedItem) _
                        Select id

Me.TblObservationBindingSource.DataSource = getSource.ToList()
tblO = TblObservationBindingSource.Current

Me.TblObservationDataGridView.DataSource = tblO

Any guidance would be much appreciated!
Karen Wilson
Karen Wilson
1 Solution
Karen WilsonProgrammerAuthor Commented:
I had to change the LINQ Query from:

Dim getSource = From id In d.tblObservations _
                         Where id.AssID = CStr(Me.cbAssID.SelectedItem) _
                         Select id


Dim getObs = From id In d.tblObservations _
                     Where id.AssID = CStr(Me.cbAssID.SelectedItem) _
                     Order By id.obsID Ascending _
                     Select id.Area, id.AssID, id.categoryID, id.dateObsCorrect, id.departID, id.Dept, id.modDate,  id.modUser, id.obsClosedDate,  id.obsComment, id.obsCorrectiveAction, id.obsDueDate, id.observDescription, id.obsID,                  id.obsOpenDate, id.obsStatus, id.Section, id.siteID, id.subCat

And then my datagridview updated with the current information.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now