datagrid combobx问题 [英] datagrid combobx problem

查看:74
本文介绍了datagrid combobx问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码


here is my code


if (e.KeyChar == 13)
           {
              panel4.Enabled = false;
           if (dataGridView1.CurrentCell.ColumnIndex == 0)
           {
                    cmb.SelectedIndexChanged += new EventHandler(cmb_SelectedIndexChanged);
                    this.cmb.Location = this.dataGridView1.GetCellDisplayRectangle(0, rowindex, true).Location;

                    this.cmb.Show();
                    this.dataGridView1.Controls.Add(cmb);
                    cmb.Select();
                    cmb.Visible = true;
                    cmb.SelectedIndexChanged += new EventHandler(cmb_SelectedIndexChanged);
                    dgvc = (DataGridViewCell)dataGridView1[dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex];
                    //dgvc.Value = cmb.SelectedText;



           }

当用户输入键时,将弹出一个combobx,但他无法在combobx显示项目上移动光标...任何伙伴都可以告诉我如何移动光标????????



谢谢Advanced

as user enter key press a combobx is popup but he is not able to move cursor on combobx display item ...can any buddy tell me how to move cursor ????????



thanks in advanced

推荐答案

问题是未选择控件.为什么要检查KeyChar而不是Keys枚举?您的代码对我来说似乎很草率,例如,您两次设置了SelectedIndexChanged事件.您意识到控件将以选定的索引开始,并且直到它更改后才会触发?那是你问题的一部分吗?如果必须将Visible设置为true,则应在选择控件之前执行此操作,选择不可见的控件将无济于事.
The issue is that the control is not selected. Why are you checking the KeyChar instead of the Keys enum ? Your code seems very sloppy to me, for example, you set the SelectedIndexChanged event twice. You realise that the control will start with a selected index, and this won''t fire until it changes ? Is that part of your issue ? If you have to set Visible to true at all, then you should do it before making the control selected, selecting an invisible control won''t do anything.


这篇关于datagrid combobx问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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