How would I clear a DataGridView from all its contents? I've tried a Clear() on the rows, but this doesn't do anything at all. This is my code:
Ranorex.Table myTable = repo.Form.TestGrid;
myTable.Rows.Clear();
Thanks!
How to clear a DataGridView (Ranorex.Table)
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: How to clear a DataGridView (Ranorex.Table)
Hi,
This is because "Clear()" clears/deletes the "IList" which you get if you call the "Rows" property.
Therefore you have to find a workaround to perform such a functionality.
Maybe you can iterate through your rows/cells and call some kind of a select and then delete each entry, but this depends on the structure and functionality of your Table.
Or you can try to iterate through your cells, call the "focus" method and perform a "Ctrl + A" and then "Delete" key event to delete each cell text.
Regards,
Markus
Ranorex Support Team
This is because "Clear()" clears/deletes the "IList" which you get if you call the "Rows" property.
Therefore you have to find a workaround to perform such a functionality.
Maybe you can iterate through your rows/cells and call some kind of a select and then delete each entry, but this depends on the structure and functionality of your Table.
Or you can try to iterate through your cells, call the "focus" method and perform a "Ctrl + A" and then "Delete" key event to delete each cell text.
Regards,
Markus
Ranorex Support Team