DataGrid delete rows nightmare

Joined
Aug 4, 2010
Messages
2
Reaction score
0
Hi there,

I thought I had a simple issue and the further I investigate the trickier it gets. What I use:
VB2005 and Windows Mobile 5.0
I want to make a program with a kind of DataGrid which show the barcodes I've read and the amounts entered by keyboard.
I thought I create a DataTable to store the data and present it in a DataGrid (by binding it) on the screen. No problem so far. Now I like to add a delete button aswell. No problem there...... well in fact there is. Once you delete a row with a command like
Code:
    x = DataGrid.Item(DataGrid.CurrentRowIndex, 0)
    TableScan.Rows.RemoveAt(x)
I found out that resulting DataGrid doesn't represent the underlying DataTable as the indexes are ****ed up. And this is not an official MS bug, it is by design.....
A solution would be (I read on the Net) to use DataGridView, but this is not supported in CF2.0 which uses Windows Mobile 5.0
Is there any solution for this?

Thanks in advance,

Albert
 
Joined
Aug 4, 2010
Messages
2
Reaction score
0
Hi there,

I've solved the problem after logging the underlying DataTable. I don't need DataGridView. The thing I did wrong was this code:
Code:
 x = DataGrid.Item(DataGrid.CurrentRowIndex, 0)
it should have been
Code:
 x = DataGrid.CurrentRowIndex
Otherwise I used the value of the first column of the selected row instead of the index value of the selected row.

Now I only need to find a methode that the first row automatically contains the index value of the DataTable and not the value in the first Column.
 

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