在gridview上的vb.net web表单控件光标 [英] vb.net web form control cursor on gridview

查看:77
本文介绍了在gridview上的vb.net web表单控件光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在vs.2005上开发vb.net代码Web表单。

我想在gridview中控制文本框上的光标焦点。我在gridview上有2个文本框。 Textbox1保留bar-code1数据。 Textbox2保留bar-code2数据。

1当输入数据到Textbox1时,按下文本框上的输入1.我希望光标移动到焦点在textbox2上。

2当输入数据到Textbox2时按文本框2上的Enter键。我想将数据插入数据库表。在我当前的代码上,我必须点击更新按钮来处理插入数据。

我不知道如何在textbox1上输入任何事件,textbox2

和所有这些代码应该放在gridview中 - RowDatabond或代码单独

公共(私有或......)Sub

谢谢大家的帮助。爱你所有

Develop vb.net code web form on vs.2005.
I want to control cursor focus on textbox in gridview. I have 2 textboxs on gridview. Textbox1 keep bar-code1 data. Textbox2 keep bar-code2 data.
1 When input data to Textbox1 press enter on textbox1.I want cursor move to focus on textbox2.
2 When input data to Textbox2 press Enter on textbox2. I want to insert data to database table. On my current code I must click on update button to process insert data.
I don't know how to code any event on press Enter on textbox1,textbox2
and all these code should place in gridview - RowDatabond or code on separate
Public (Private or ...) Sub
Thank you everyone who help.Love you all

推荐答案

你应该从TextBox中捕获KeyDown-Event。

如果KeyCode与Enter匹配,则将Focus赋予第二个TextBox。



You should catch the KeyDown-Event from your TextBox.
If the KeyCode matches to Enter then give the Focus to the 2nd TextBox.

Private Sub TextBox1_KeyDown(sender As System.Object, e As KeyEventArgs) Handles TextBox1.KeyDown
    If e.KeyCode = Keys.Enter Then TextBox2.Focus()
End Sub

Private Sub TextBox2_KeyDown(sender As System.Object, e As KeyEventArgs) Handles TextBox2.KeyDown
    If e.KeyCode = Keys.Enter Then TextBox1.Focus()
End Sub


这篇关于在gridview上的vb.net web表单控件光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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