简体   繁体   English

Windows Embedded CE 5.0移动应用程序gridview C#

[英]Windows Embedded CE 5.0 mobile app gridview C#

Im busy with a Windows Embedded CE 5.0 mobile app. 我正忙于Windows Embedded CE 5.0移动应用程序。 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). 我想向网格添加一个额外的列(已经做到了。我从double中添加了null)。 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: 这是我的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();
    }

在此处输入图片说明

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. 因此,例如,当用户单击Pack_Units的第一个字段时,我希望他们能够编辑该字段。

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#. 我在VS 2005 c#中使用Oracle数据库。

Thanks in advance! 提前致谢!

To get a value of currently selected cell (assume dgSku is your DataGrid): 要获取当前选定单元格的值(假设dgSku是您的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. 您本质上需要的是一个由TextBoxes组成的列,并且由于.NETCF仅提供了等效于桌面的功能的子集,因此您必须自己制作一个。 Have a look here and here , this should give you a good starting point. 在这里这里看看,这应该为您提供一个良好的起点。

StaWho is right, CF does not support inline editing. StaWho是正确的,CF不支持嵌入式编辑。 Paul Yao has a nice solution in his book "Programming the .Net Compact Framework". Paul Yao在他的《对.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. 另一个解决方法是将一个文本字段添加到表单,并使用grid click事件显示和更改Pack_Units列的值以进行编辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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