输入键的文本框事件处理 [英] textbox event handling for enter key
本文介绍了输入键的文本框事件处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在文本框中写了一些东西,当按下Enter键时,会出现一个msgbox.您能给我源代码吗.
解决方案
文本框.
在您的keydown事件中,检查e.keycode是否为Enter键,如果是这种情况,请显示您的消息框.
并实际学习VB.NET,因为这是真正的基础知识.
在 textbox 的 KeyDown 事件中复制以下代码. :-O:笑:
私有 子 TextBox1_KeyDown( ByVal 发件人 As 系统.对象, ByVal e As System.Windows.Forms.KeyEventArgs)句柄 TextBox1.KeyDown 如果(e.KeyCode = Keys.Enter)然后 MsgBox(" ) 结束 如果 结束 子
I write something in textbox and when enter key is pressed a msgbox appear.Can u give me source code.
解决方案There are events for keypress and keydown for textboxes.
In your keydown-event check whether e.keycode is enter-key and if that is the case, then show your messagebox.
And actually learn VB.NET since this is real basic stuff.
in KeyDown event of textbox copy following code..! :-O :laugh:
Private Sub TextBox1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If (e.KeyCode = Keys.Enter) Then MsgBox("Enter key pressed") End If End Sub
这篇关于输入键的文本框事件处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文