二、获取表格数据

 int selectRow = gridView1.GetSelectedRows()[0];
string id = this.gridView1.GetRowCellValue(selectRow, "id").ToString();

  

            string colValue = this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, this.gridView1.Columns["qty"]).ToString();
var s = gridView1.GetDataRow(e.RowHandle)["列名"].ToString(); //当前单元格所在行的数据
        注意 e.value 获取当前编辑的值,上面对编辑单元格无效,只可以触发 GridView1_CellValueChanging 事件

  

'设置单元格中的值
GridView.SetRowCellValue(GridView.FocusedRowHandle, GridView.Columns("列名"),"要设置的值") '得到单元格中的值
Me.GridView_Analysis.GetRowCellValue(GridView.FocusedRowHandle, "列名") '数据表中当前单元格的值
DataSet.Tables(0).Rows(GridView.FocusedRowHandle).Item("列名")

一、Dev单元格只允许输入数字 

        private void GridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
{
if (Convert.ToInt32(this.gridView1.GetDataRow(e.RowHandle)["qty"]) < e.Value.ToInt())
{
this.gridView1.SetRowCellValue(e.RowHandle, "pick_qty", Convert.ToInt32(this.gridView1.GetDataRow(e.RowHandle)["qty"]));
this.gridView1.SetRowCellValue(e.RowHandle, "qty-pick_qty", 0);
}
else if (e.Value.ToString() == "")
{
this.gridView1.SetRowCellValue(e.RowHandle, "pick_qty", 0);
this.gridView1.SetRowCellValue(e.RowHandle, "qty-pick_qty", Convert.ToInt32(this.gridView1.GetDataRow(e.RowHandle)["qty"]));
}
else
{
this.gridView1.SetRowCellValue(e.RowHandle, "qty-pick_qty", Convert.ToInt32(this.gridView1.GetDataRow(e.RowHandle)["qty"]) - e.Value.ToInt());
}
} private void GridData_EditorKeyPress(object sender, KeyPressEventArgs e)
{
GridControl grid = sender as GridControl;
gridView1_KeyPress(grid.FocusedView, e);
}
private void gridView1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\b' || e.KeyChar == '\r')
{
e.Handled = false;
return;
}
GridView view = sender as GridView;
string s = "0123456789\b";
if (view.FocusedColumn.FieldName == "pick_qty" && s.LastIndexOf(e.KeyChar) >= 0)
{
e.Handled = false; }
else
e.Handled = true;
}

  

一、Dev单元格的更多相关文章

  1. Dev控件GridView单元格绑定控件

    Dev控件GridView单元格绑定控件 //文本按钮 RepositoryItemButtonEdit btnFields = new RepositoryItemButtonEdit();//创建 ...

  2. DEV 财务货币格式单元格

    在用友金蝶等财务软件中,经常需要输入货币类型的数据, 那么这种输入框要如何制作呢? 扩展DataGridView 的功能  出自在天空飞翔博客 http://www.cnblogs.com/micha ...

  3. Dev GridControl 按条件合并相同单元格

    Dev 默认的合并方式,只要(垂直方向)相邻两个单元格的值相同都会进行合并,这种方式并不是最优的,所以需要在进行合并的过程中进行判断. 方式如下: 1:先设置需要合并的列为允许合并 OptionsVi ...

  4. dev gridview指定单元格cell获取坐标

    DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo Info2 = gvQueryResult.GetViewInfo() as DevExpre ...

  5. Dev GridControl,GridView 显示多行文本及合并相同单元格

    显示多行文本的方法 首先把gridcontrol的views的Optionsview里的RowAutoHeight设置为True 在In-place Editor Repository 里添加 Mem ...

  6. DEV GridControl 根据单元格值改变背景色

    GridControl 根据单元格值改变背景色(需要用到CustomDrawCell事件) 方法1: private void gdvClient_CustomDrawCell(object send ...

  7. dev GridControl直接打印 纵向合并单元格

    GridControl纵向合并单元格 只需设置 gridView->OptionView->AllowCellMerge=true; 效果 提示: 精确到列 前提是gridview1已经允 ...

  8. DEV gridview根据单元格值改变其他单元格格式

    string style = ""; private void gridView1_RowCellStyle(object sender, DevExpress.XtraGrid. ...

  9. DevExpress控件-GridControl根据条件改变单元格(Dev GridControl 单元格着色)

    DevExpress控件-GridControl根据条件改变单元格颜色,如下图: 解决办法:可以参考:http://www.cnblogs.com/zeroone/p/4311191.html 第一步 ...

随机推荐

  1. 微信硬件平台(八) 1 esp8266从自己的服务器获取token

    从txt获取token #include <ESP8266WiFi.h> #define host_token "www.dongvdong.top" #define ...

  2. Oracle 迁移 序列

    ---删除序列select 'drop sequence ' || sequence_owner || '.' || SEQUENCE_NAME || ';'from dba_sequenceswhe ...

  3. linux内存源码分析 - SLUB分配器概述

    本文为原创,转载请注明:http://www.cnblogs.com/tolimit/ SLUB和SLAB的区别 首先为什么要说slub分配器,内核里小内存分配一共有三种,SLAB/SLUB/SLOB ...

  4. PHP创建socket服务

    PHP可以创建socket服务. 先熟悉几个php网络方面的函数,操作手册地址  http://php.net/manual/zh/ref.sockets.php 简单介绍下socket,它表示套接字 ...

  5. Volley使用

    Volley是常用的网络请求框架,主要的用法如下: 获取字符串: public static void volleyTest1(final Context context){ RequestQueue ...

  6. C# 相关面试试题简单的总结

    最近一个搞NET开发的朋友离职了,想让我给他找点关于NET的相关面试题,准备抱一下佛脚,迎接新的挑战. 我赶紧找到以前检索的各种宝典,试题,今天梳理一下关于NET的基础知识点. 1.面向对象语言的三大 ...

  7. 使用后台线程BackgroundWorker处理任务的总结

    在一些耗时的操作过程中,在长时间运行时可能会导致用户界面 (UI) 处于停止响应状态,用户在这操作期间无法进行其他的操作,为了不使UI层处于停止响应状态,我们倾向推荐用户使用BackgroundWor ...

  8. 前后端分离的利器:fiddler的实用功能举例

    # 前后端分离的利器:fiddler的实用功能举例 ##what's fiddler fiddler是一款代理软件,对于前后端分离开发非常重要.可以说,如果前端开发没有用上fiddler或类似软件,那 ...

  9. Python_每日习题-0008-九九乘法表

    题目: 输出9*9乘法口诀表. 程序分析:分行与分列的考虑,共9行9列,i控制行,j控制列. for i in range(1, 10): for j in range(1, i+1): print( ...

  10. Linux下设置MySql自动启动

    https://www.cnblogs.com/sunny3096/p/7954146.html