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
diane falzon
NA
1
0
Datagridview delete
Mar 14 2010 8:31 AM
Hi i have a data table and is used like ths to add data todatagrid view (dgv) dt2 is the datatable.
DataGridViewRow row = dgv.SelectedRows[0];
string a = row.Cells[0].Value.ToString();
string b = row.Cells[1].Value.ToString();
dt2.Rows.Add(a, b);
dgvBill.DataSource = dt2;
Now when i am trying to delete from the datagridview the following error is occuring: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index.
the thing is that on the datagrid i have values so i am not sure why this is happining :/
DataGridViewRow row = dgv.SelectedRows[0];
int a = row.Cells[0].RowIndex;
dgvBill.Rows.RemoveAt(a);
dgvBill.Refresh();
Reply
Answers (
2
)
Data retrieving from SQL Server with C#
parallel port event handler?