I have find solution for DataGridView in vb.net
There is a one datagridview with edit and delete column with image buttons for edit,delete as a rows
Now how can i delete particular row after select gridview image delete button in vb.net
and same way for edit image button too.
if any one help me out then please help me ASAP.
Thank You.
What I have tried:
Private Sub DataGridView1_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DataGridView1.CellPainting
If e.ColumnIndex = 3 AndAlso e.RowIndex >= 0 Then
e.Paint(e.CellBounds, DataGridViewPaintParts.All)
Dim img As Image = Image.FromFile("C:\Users\VP\Documents\Visual Studio 2008\Projects\vp\vp\Resources\1.png")
e.Graphics.DrawImage(img, e.CellBounds.Left + 30, e.CellBounds.Top + 5, 10, 10)
e.Handled = True
ElseIf e.ColumnIndex = 4 AndAlso e.RowIndex >= 0 Then
e.Paint(e.CellBounds, DataGridViewPaintParts.All)
Dim img As Image = Image.FromFile("C:\Users\VP\Documents\Visual Studio 2008\Projects\vp\vp\Resources\1.png")
e.Graphics.DrawImage(img, e.CellBounds.Left + 30, e.CellBounds.Top + 5, 10, 10)
e.Handled = True
End If
End Sub
Private Sub viewplans_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim btnColumn As New DataGridViewButtonColumn()
DataGridView1.Columns.Add(btnColumn)
btnColumn.Name = "btnColumn"
btnColumn.HeaderText = "Delete"
Dim editcolumn As New DataGridViewButtonColumn()
DataGridView1.Columns.Add(editcolumn)
editcolumn.Name = "editcolumn"
editcolumn.HeaderText = "Edit"
end sub