dataTable.Clear()

G

goldie11

Hi,

I would like to remove all the rows of a DataTable - but not by using a
loop through all the DataRows - but by using a single command.
I tried - dataTable.Clear() which is supposed to remove all rows of the
dataTable - but it doesn't seem to work - the table is still full.

Any idea?

Thanks you all.
 
J

Jesús López

Please, can you elaborate on "but it doesn't seem to work" ?. Based on my
experience, DataTable.Clear() works fine and as expected ...

Regards,

Jesús López
 
R

RobinS

He could use datatable.reset -- this returns the datatable
to its original, uninitialized state.

Robin S.
 
D

diego

Cor,

the op said he only wanted to clear the rows, not the columns as well.

Diego

Ayon kay Cor Ligthert [MVP]:
 
C

Cor Ligthert [MVP]

Yea,

But datatable.clear as Jesus wrote should do that fine, therefore we should
in my idea wait on the answer on that, can be interesting..

Cor
 
N

nil

Cor said:
Yea,

But datatable.clear as Jesus wrote should do that fine, therefore we should
in my idea wait on the answer on that, can be interesting..

Cor


to clear rows of the datatable use
datatable.rows.clear
and it works fine and to clear columns use
datatable.columns.clear
and it will work

Thanks & Regards,
Nil
"Problem is just the distance between the expectation and the reality"
 

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