Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleRemove the current row from a DataGridView control in Visual Basic 2005
DescriptionThis example shows how to remove the current row from a DataGridView control in Visual Basic 2005.
KeywordsDataGridView, remove row, delete row, Visual Basic 2005, VB 2005
CategoriesControls, VB.NET
 
Use the Rows collection's Remove or RemoveAt method. The following code checks to see if the current row is new because you cannot delete a new row. It then removes the current row.
 
Private Sub btnDelete_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnDelete.Click
    If Not DataGridView1.CurrentRow.IsNewRow Then
        DataGridView1.Rows.Remove(DataGridView1.CurrentRow)
    End If
End Sub
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated