二、获取表格数据

 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. Python 在 Terminal 中的自动补全

    为了在 Terminal 中使用 Python 更加方便,在 home 目录下添加脚本 .pythonstartup,内容如下, 然后在 .bashrc 中添加 export PYTHONSTARTU ...

  2. 【原创】三招搞死你的IE11,可重现代码下载(IE Crash keyframes iframe)!

    前言 很多人都知道我们在做FineUI控件库,而且我们也做了超过 9 年的时间,在和浏览器无数次的交往中,也发现了多个浏览器自身的BUG,并公开出来方便大家查阅: 分享IE7一个神奇的BUG(不是封闭 ...

  3. Android开发常用权限设置

    加在AndroidManifest.xml 文件中manifest标签以内,application以外 例如:<!--网络权限 --> <uses-permission androi ...

  4. MyBatis-你所不了解的sql和include

    目录 <sql> 节点的基础 <include> 节点 <sql> 节点包含的节点 一起来学习 mybatis @ 在前一篇[MyBatis动态SQL(认真看看, ...

  5. 有一个IT男友是怎么样体验呢?

      前言:          一提到IT男,大家就会惯性的给他贴上无趣,情商低,屌丝,技术宅的的等标签.那么作为一个IT男的女友到底是什么样的体验呢? 礼物:         别人的男朋友送礼物,一般 ...

  6. 现代JavaScript函数库 usuallyjs 的安装和使用

    usuallyjs usuallyjs 是一个面向现代 Web 开发的 JavaScript 实用函数库. usuallyjs 基于 ES6 开发,抛弃了传统 Web 开发中 DOM 和 BOM 操作 ...

  7. Leetcode 686 Repeated String Match

    Given two strings A and B, find the minimum number of times A has to be repeated such that B is a su ...

  8. Windows下如何更新 CodeBlocks 中的 MinGW 使其支持新版本 C++

    转自:http://blog.csdn.net/wtfmonking/article/details/17487705 虽然 CodeBlocks16.01 已经是最新版了,但其中的 MinGW 仍然 ...

  9. Latex(表格|图片(一丢丢))

    目录 普通的例子 Notation 例子 p{width} 列分割符 @{} \multicolumn supertabular | longtabular 浮动体 table 浮动体 图片 \use ...

  10. (Beta)团队贡献分

    Beta阶段团队每个成员都积极响应一起完成了开发, 所以最后我们一致决定各个成员的贡献分相同. 林珣玙 53 康家华 52 张启东 51 刘彦熙 49 马瑶华 48 仇栋民 47