数据网格视图的属性 [英] Properties of Data Grid View

查看:62
本文介绍了数据网格视图的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的会员



i有一个数据网格视图,我想按Enter键时移动按钮我的光标只有那些只读属性为false的单元格。到达最后一个单元格它移动到下一行,其中只读属性为false的单元格。



i尝试gridview的许多属性,但这些属性不起作用。



请帮帮我



代码项目成员



Akhilesh Pandit

Dear Members

i have a Data Gridview,i want to move when i press Enter Button my cursor only those cell whose read only properties is false.and when cursor reach last cell it move to next row in which cell whose read only properties is false.

i try many of properties of gridview but these properties are not working.

Please Help me

Member of Code Project

Akhilesh Pandit

推荐答案

尝试使用此代码:

Try with this code :
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {                
                e.SuppressKeyPress=true;
                int iColumn = dataGridView1.CurrentCell.ColumnIndex;
                int iRow = dataGridView1.CurrentCell.RowIndex;
                if (iColumn == dataGridView1.Columns.Count-1)
                    dataGridView1.CurrentCell = dataGridView1[0, iRow + 1];
                else
                    dataGridView1.CurrentCell = dataGridView1[iColumn + 1, iRow];

            }
        }



也可以查看..

在datagridview控件中按Enter键时将焦点设置到下一个单元格[ ^ ]

在datagridview控件中按Enter键时,将焦点设置到下一个单元格? [ ^ ]

DataGridView-当我按下输入时,它会转到下一个单元格 [ ^ ]


Also can view..
Set focus to next cell when pressing enter key in datagridview control[^]
Set focus to next cell when pressing enter key in datagridview control?[^]
DataGridView-when I press enter it goes to the next cell[^]


这篇关于数据网格视图的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆