views:

329

answers:

1

This seems quite odd. I have a Datagrid (.net 3.5 cf) that I bind to either a List or Inventory[]. When I click on a row and then hit a button to perform an action when I bind to a List CurrentRowIndex is -1. When I bind to Inventory[] and perform the same action CurrentRowIndex comes back with the selected row why is that??

grdBatch.DataSource = InventoryItems.ToArray();

vs

grdBatch.DataSource = InventoryItems;
A: 

Hmmm, I'm having trouble replicating the problem (array and list both work fine for me). What is the target system? Also, what is the operation that you are performing?

You might try using a BindingSource as the intermediary between your list and your datagrid, not sure if it would help though. Something along these lines:

BindingSource bs = new BindingSource();
bs.DataSource = InventoryItems;
grdBatch.DataSource = bs;
AlexCuse