gridview中文本框的Onkeyenter事件 [英] Onkeyenter event of textbox in a gridview

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

问题描述

我在datagrid中有一个文本框和下拉列表。如果我在文本框中输入下拉列表的值字段,我想在下拉列表中选择相应的项目。我怎么能这样做。谁能帮帮我?我需要在vb.net编码c#

i have one textbox and dropdown in datagrid. if am entering the value field of the dropdown in textbox i want to select corresponding item in dropdown. how can i do this .can anyone help me? i need coding in vb.net c#

推荐答案





这里是一个快速类似的示例代码textbox和ListBox。





Hi,

here's a quick similar example code with textbox and ListBox.


for (int i = 0; i <= listBox1.Items.Count; i++)
            {
                if (listBox1.Items[i].ToString() == textBox1.Text)
                {
                    listBox1.SelectedIndex = i;
                    break;
                }
            }





也应该适合你。



最好的问候



Should also work for you.

Best Regards


根据您的要求在datagrid rowbound事件或数据绑定事件中尝试以下方法。





Try this below method in the datagrid rowbound event or databound event according to your requirement.


Private Sub textBox1_KeyUp(sender As Object, e As KeyEventArgs)
    If textBox1.Text <> String.Empty Then
        cmbFile.SelectedValue = textBox1.Text

        
    End If
End Sub


这篇关于gridview中文本框的Onkeyenter事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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