Datagridview Error
-
I have a datagridview bound to a datatable. When I remove a row from the datatable the grid reflects the change, but when I attempted to add a row back in I get an error System Index out of Range? I have tried datagridview1.Refresh() with no luck. What am I missing? Thanks
-
I have a datagridview bound to a datatable. When I remove a row from the datatable the grid reflects the change, but when I attempted to add a row back in I get an error System Index out of Range? I have tried datagridview1.Refresh() with no luck. What am I missing? Thanks
Instead of refresh you can try to rebind the grid after deleting. (or) if this is a wrong solution a code sample would help a lot to give clear solution.
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
Instead of refresh you can try to rebind the grid after deleting. (or) if this is a wrong solution a code sample would help a lot to give clear solution.
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
Is there an article or code sample showing rebinding? Here is my code: //Are there rows that need to be deleted? for (int x = 0; x < dsInvoice.Tables["Invoice"].Rows.Count; x++) { if (dsInvoice.Tables["Invoice"].Rows[x]["QTYORD"].ToString() == "0") { dsInvoice.Tables["Invoice"].Rows[x].Delete(); dataGridView1.Refresh(); } } Thanks for all your help
-
Is there an article or code sample showing rebinding? Here is my code: //Are there rows that need to be deleted? for (int x = 0; x < dsInvoice.Tables["Invoice"].Rows.Count; x++) { if (dsInvoice.Tables["Invoice"].Rows[x]["QTYORD"].ToString() == "0") { dsInvoice.Tables["Invoice"].Rows[x].Delete(); dataGridView1.Refresh(); } } Thanks for all your help
Here is the mistake, you are getting the value from the database but after that deleting temporary. This will not reflect in database. Check my articles Refer 1:Temporary Values in Grid[^] Refer 2:GridView all in one[^]
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
-
Here is the mistake, you are getting the value from the database but after that deleting temporary. This will not reflect in database. Check my articles Refer 1:Temporary Values in Grid[^] Refer 2:GridView all in one[^]
Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]
I don't understand please forgive me. I am new to Datagridview grids. After I remove the row from datatable what do I need to do next? I read through your articles, but I am confused??
-
I have a datagridview bound to a datatable. When I remove a row from the datatable the grid reflects the change, but when I attempted to add a row back in I get an error System Index out of Range? I have tried datagridview1.Refresh() with no luck. What am I missing? Thanks
-
I created a DataSource with a DataTable in it and added it through the wizzard when I added the Grid to my form. When a user enters 0 in the first cell I want to remove that row from the grid. I hope this helps Thanks!
-
I created a DataSource with a DataTable in it and added it through the wizzard when I added the Grid to my form. When a user enters 0 in the first cell I want to remove that row from the grid. I hope this helps Thanks!
-
How are you adding the row after deletion? Since you are getting IndexOutOfRange exception, you should check all the indexes you are using while adding the row.
I am clicking on the first cell in the next available row when I receive the error. When I selected the datatable to use for the grid it created a binding source. When I try to execute the RemoveAt with the binding source it errors out. Is there an easier way to do this?
-
I am clicking on the first cell in the next available row when I receive the error. When I selected the datatable to use for the grid it created a binding source. When I try to execute the RemoveAt with the binding source it errors out. Is there an easier way to do this?