Hi,
I am struggling to delete a row from a datatable that I have bound to my DGV (datagridview).
The DGV is not full row selection thing and users can click only on one cell at time.
I can delete the row from the DGV but the row is not actually deleted form the datatable.
Will someone please help me to figure it out?
Thanks.
here my tires:
This is how I bind the datatable to the DGV:
I am struggling to delete a row from a datatable that I have bound to my DGV (datagridview).
The DGV is not full row selection thing and users can click only on one cell at time.
I can delete the row from the DGV but the row is not actually deleted form the datatable.
Will someone please help me to figure it out?
Thanks.
here my tires:
Code:
DataGridView1.Rows.RemoveAt(DataGridView1.CurrentCell.RowIndex)' Obviously nothing is happening to the datatabel here
''
Code:
Dim MyBindingSource As New BindingSource()
If Shared_AlertTable_Local.Rows.Count > 0 Then
Dim tempDT As DataTable = Shared_AlertTable_Local.DefaultView.ToTable(True, "Interval", "ToBeNotified", "Escalation", "WhomToEscalate", "HowToAlert")
MyBindingSource.DataSource = tempDT
With DataGridView1
.DataSource = MyBindingSource
.RowHeadersVisible = False
.EnableHeadersVisualStyles = False
.AllowUserToAddRows = False
.BackgroundColor = Color.White
.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing
End With
EnableDoubleBuffered(DataGridView1)
Else
Call RemoveBindingSourceForDGV(DataGridView1)
End If