简体   繁体   中英

Retrieving data from a datagrid using compact framework 3.5

I am building a mobile application which allows operators to manage their jobs in the field. I am using a datagrid to display the users Job list. The user will be able to accept or decline jobs by selecting the gridview row and assigning a status to it via a combo box.

To do this I need to get the value of cell 9 (JobID) for the selected row of the datagrid. Because I am using .NET Compact framework I'm unable to access certain properties such as SelectedRow. I've spent all morning trawling the web for pointers but most examples I find are targeted at .NET framework, rather than .NET Compact Framework. This is no help to me at all because all examples seem to reference System.Web.UI which I am led to believe isn't available for .NET CF

Can anyone offer me any suggestions to achieve this for smart device applications. All help will be greatly appreciated.

Thanks in advance.

I would use the CurrentCell propery on the datagrid to determin what row that has focus and then select out the wanted value from that row.

int row = dgJobList.CurrentCell.RowNumber;
int column = 9;
string cellValue = dgJobList[row,column].toString();

thank you @mattias. As a VB .net user I will give my own code to do the same thing.

dim rom as integer

dim column as integer

dim cellvalue as string

row = dgJobList.CurrentCell.RowNumber

column = 9

cellValue = dgJobList(row,column).toString()

You can use ctype() to get the content of the cell with a specific type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM