Question

Im busy with a Windows Embedded CE 5.0 mobile app. I'm a bit stuck at the moment. I'm using a datagrid with data. I want to add a extra column to the grid(already did this. I added null from dual). Now in app i want users to be able to change the value of the field(how many units are in one pack).

Here is my code for the Datagrid:

private void gridView()
    {
        conn.Open();
        string query = "select distinct s.sku_id_no SKU_id, (pt.product_type_desc|| ' ' ||ps.prod_size_desc|| ' ' ||c.colour_desc) Product_Desc, null Pack_Units from sku s , product_type pt , prod_size ps , colour c , purch_order_carton_sku pocs, purch_order_carton_sku poc, dual where pocs.order_no ='" + this.orderCode + "' and pocs.carton_code ='" + this.cartonCode + "' and pocs.sku_id_no = s.sku_id_no and s.prod_size_id_no = ps.prod_size_id_no(+) and s.colour_id_no = c.colour_id_no(+)";
        OracleDataAdapter da = new OracleDataAdapter(query, conn);
        OracleDataSet ds = new OracleDataSet();
        da.Fill(ds);
        dgSku.DataSource = ds.Tables[0]; 
    {

Then I call the grid when screen loads like this:

private void frmCartonContentVerification_Load(object sender, EventArgs e)
    {
        gridView();
    }

enter image description here

So above is how it looks at the moment. So when a user for example click the first field of Pack_Units i want them to be able to edit the field.

Goal is when they click the NEXT button a validation procedure must run and check if that is correct. So it will be great if some can also show me how to get the value from a select field??

Im using Oracle database with VS 2005 c#.

Thanks in advance!

Was it helpful?

Solution

To get a value of currently selected cell (assume dgSku is your DataGrid):

var value = dgSku[dgSku.CurrentCell.RowNumber, dgSku.CurrentCell.ColumnNumber];

To be able to edit field....I'm afraid the solution is fairly painful. What you essentialy need is a column that is made up of TextBoxes, and because .NETCF provides only a subset of desktop equivalent's functionality you have to make one yourself. Have a look here and here, this should give you a good starting point.

OTHER TIPS

StaWho is right, CF does not support inline editing. Paul Yao has a nice solution in his book "Programming the .Net Compact Framework".

Another workaround would be to add one textfield to the form and use the grid click event to display and change the value of the Pack_Units column for editing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top