TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
John Beeman
NA
15
0
How to delete specific rows in a datagridview?
Jul 29 2008 11:20 AM
I have a datagridview on a windows form and I want to be able to delete all rows that have a negative or zero value within a specific column (when user presses button), but I don't know the best way to approach this.
dataGridView2 example:
1 48.54 Col 3 Ref
2 78.14 Col 3 Ref
3 -148.52 Col 3 Ref
4 486.45 Col 3 Ref
Could someone provide assistance on the best way to do this?
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView2.Rows.Count; i++)
{
if (double.Parse(dataGridView2.Rows[i].Cells[1].Value.ToString()) < 0)
{
//What do I need to delete row?
i = i -1;
}
}
}
Reply
Answers (
1
)
Simple Port Scanner
Help in C sharp