DataTable.Clear() throws System.ArgumentOutOfRangeException

G

Guest

Clearing a datatable of all data, I would think be a simple task. Does anyone have an idea why the DataTable.Clear() method could throw a System.ArgumentOutOfRangeException. Also, this problem doesn't seem to be consistent or 100% reproducable. Perhaps it depends on the data in the table. Any suggestions? Sorry the description is so vague, but there really is anymore info I can think to add.
 
M

Miha Markic

Huh,

Is your datatable binded, are you implementing its events, calculated
columns, anything?

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

TALDeveloper said:
Clearing a datatable of all data, I would think be a simple task. Does
anyone have an idea why the DataTable.Clear() method could throw a
System.ArgumentOutOfRangeException. Also, this problem doesn't seem to be
consistent or 100% reproducable. Perhaps it depends on the data in the
table. Any suggestions? Sorry the description is so vague, but there
really is anymore info I can think to add.
 
D

David Massat

Yes, the table is bound to a grid. There is a calculation column but it
was added through the grid, not through the datatable. Example:

grid1.Band[0].Columns.Add("CalculatedColumn",typeof(decimal));
 
M

Miha Markic

Hi David,

a) Try detaching datatable from grid before calling clear
b) try removing calculated column before clear
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top