Refreshing a DGV

  • Thread starter Thread starter gwboolean
  • Start date Start date
G

gwboolean

Guest
I have a DGV that is setup for the user to double click on a row that will then open another form displaying the data from the row selected. I neither hide nor close the DGV that is open behind the form displaying the record.

So, the record form has a button for deleting the record and this works just fine. My problem is that when I close this window, I need to refresh (I don't know what other word to use) the DGV so that the record I deleted no longer is displayed in the DGV.

Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
If (MessageBox.Show("Are you sure you want to delete this record?", "Delete Record",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) = MsgBoxResult.Yes) Then
Try
FileMasterManager.RemoveAt(FileMasterManager.Position)
FileMasterAdapter.Update(FileMasterTable)
MasterBaseConnection.Close()
MasterBaseConnection.Dispose()
FileMasterCommand.Dispose()
FileMasterAdapter.Dispose()
FileMasterTable.Dispose()
Me.Close()
MessageBox.Show("Record Deleted.", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As Exception
MessageBox.Show("Error deleting record.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Else
frmDataGridList.Refresh()
End If
End Sub


This is one of a number of attempts that did not work. So how do I make the DGV redisplay without showing the deleted record?




gwboolean

Continue reading...
 
Back
Top