I get a Exception when I try to delete a dataRowView in Compact Framework

G

garbage

Hello people,

I'm developing a mobile app with Compact Framework.

I have a grid, and it's dataSource is a dataView (named dvi).

When I try to delete a row from this dataView, it throws an exception:

"An unhandled exception of type 'System.ArgumentOutOfRangeException'
occurred in mscorlib.dll

Additional information: ArgumentOutOfRangeException"...

This exception occurs on the line:

dvi[0].Delete();

I used de "0" index, to be sure that the problem is not the row index,
but this value will be a variable.

Have anyone had this problem before?

Thanks for your answers...
 
?

=?iso-8859-1?q?F=E9rnas_-_Brasil?=

Hey people... I found the answer for my problem...

If you are looking for the same answer, here it goes..

You should, before deleting the row, set as null any control that uses
the dataView as dataSource...

like:

datagrid.DataSource = null;
dvi.AllowDelete = true;
dataRowViewVariable.delete();
datagrid.dataSource = dvi; // dvi is the name of the dataview

uhuuuuuuuuuuuuuuuuuuuuu, i got very glad!

I was looking for this answer a long time.. let's keep on..

thanks!
 

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