Hello Good People,
I have a DataGridView called (DGVMultiRecords) and a Combo Box, When I select a value from the Combo Box, The DataGridView is populated with data I am searching for, The when I click on a record in the DataGridView. and I want to delete the selected row. I click a button called (CmdDelete)
This is where I have an issue, The record is deleted, But the DataGridView does not update after Deletion, But when I close the form and reload the record is not there it has been deleted. I have tried remove current, this is where I get an error message. Picture and Code Below.
Can any of you good People Help me please
Kind Regards
Gary

Private Sub CmdDelete_Click(sender As Object, e As EventArgs) Handles CmdDelete.Click
Dim Dialog As DialogResult
Dialog = MessageBox.Show("Are You sure you want to Delete this record Permanently",
FrmMenu.LbMemberName.Text, MessageBoxButtons.YesNo)
If Dialog = Windows.Forms.DialogResult.No Then
'Do Nothing
MsgBox(FrmMenu.LbMemberName.Text & ", You Have Selected NOT to Delete This Record",
MsgBoxStyle.Information, "Record is Safe")
End If
If Dialog = Windows.Forms.DialogResult.Yes Then
MsgBox("Record Deleted ", MsgBoxStyle.Information, FrmMenu.LbMemberName.Text & ", Deleted Successfully")
MultiRecordsBindingNavigator.DeleteItem.PerformClick()
DeleteFromMultiRecords()
MultiRecordsBindingSource.RemoveCurrent()
'DGVMultiRecords.DataSource = SQL.SQLDT
End If
End Sub
Private Sub DeleteFromMultiRecords()
SQL.RunQuery("SELECT * FROM MultiRecords ")
If SQL.RecordCount < 1 Then
MsgBox("There are no records to delete ", MsgBoxStyle.Exclamation, "No Records In Your Database (Multi Records)")
Exit Sub
Else
SQL.AddParam("@MultiDropID", LbMultiDropID.Text)
SQL.ExecQuery("DELETE " &
"FROM MultiRecords " &
"WHERE MultiDropID=@MultiDropID ")
If SQL.HasException(True) Then Exit Sub
'Dim DGV As DataGridViewRow = DGVMultiRecords.SelectedRows(0)
'MultiRecordsBindingSource.RemoveCurrent(0)
'DGVMultiRecords.DataSource = DGV
End If
End Sub