表格的受压迫事件 [英] Keypressed event of a form
问题描述
伙计们,
我是dot net的新手,想知道我怎样才能以同样的方式重拍
vb6,捕获所有的按键表格,
每个例子我在表格上寻找一些按键
privete sub form_keypressed(keyascii as integer)
如果keyascii = 13则输入密钥
呼叫button_click
结束如果
end sub
到目前为止我在vb .net中得到的是:
私有子FrmMain_KeyPress(ByVal发送者作为对象,ByVal e As
系统.Windows.Forms.KeyPressEventArgs)处理MyBase.KeyPress
如果e.KeyChar =" P"或者e.KeyChar =p然后
e.Handled = True
致电BtmProduit_Click(发件人,e)
结束如果
结束子
哪个不起作用,并且任何事件都没有发生任何事件,所以看完
论坛和互联网,香港专业教育学院没有找到任何工作,
提前多多谢谢!
他
Hi guys,
Im new to dot net and wondering how i could remake the same way i was in
vb6, capture all keypress whitin a form,
per exemple i was on the form looking for some keypress
privete sub form_keypressed(keyascii as integer)
if keyascii = 13 then ''for the enter key
call button_click
end if
end sub
what i got so far in vb .net is :
Private Sub FrmMain_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
If e.KeyChar = "P" Or e.KeyChar = "p" Then
e.Handled = True
Call BtmProduit_Click(sender, e)
End If
end sub
which is not working and dosent fire any event at all, so after looking the
forum and internet, ive found nothing that was working,
Thanks a lot in advance !
Him
推荐答案
Himselff写道:
Himselff wrote:
大家好,
我是dot net的新手,想知道我怎么能以同样的方式重拍我在
vb6中,在一个表单中捕获所有按键,
每个例子我在表单上寻找一些按键
privete sub form_keypressed(keyascii as integer) )
如果keyascii = 13那么''为回车键
调用button_click
结束如果
结束子
到目前为止我在vb中得到了什么。 net是:
私有子FrmMain_KeyPress(ByVal发送者作为对象,ByVal e As
System.Wi ndows.Forms.KeyPressEventArgs)处理MyBase.KeyPress
如果e.KeyChar =" P"或者e.KeyChar =p然后
e.Handled = True
调用BtmProduit_Click(发件人,e)
结束如果
结束sub <什么都没有工作,并且根本无法触发任何事件,所以在查看了论坛和互联网之后,我发现没有任何工作,
非常感谢提前!
他
Hi guys,
Im new to dot net and wondering how i could remake the same way i was in
vb6, capture all keypress whitin a form,
per exemple i was on the form looking for some keypress
privete sub form_keypressed(keyascii as integer)
if keyascii = 13 then ''for the enter key
call button_click
end if
end sub
what i got so far in vb .net is :
Private Sub FrmMain_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
If e.KeyChar = "P" Or e.KeyChar = "p" Then
e.Handled = True
Call BtmProduit_Click(sender, e)
End If
end sub
which is not working and dosent fire any event at all, so after looking the
forum and internet, ive found nothing that was working,
Thanks a lot in advance !
Him
您是否将表单的keypreview设置为true?
我也会把你的if改为:
如果UCase(e.KeyChar)=" P"然后
-
Rinze van Huizen
C-Services Holland bv
Did you set the keypreview setting of the form to true?
Also I''d change your if to something like:
If UCase(e.KeyChar)="P" then
--
Rinze van Huizen
C-Services Holland b.v.
>
Ive阅读关于keypreview但我找不到任何东西,是一个表单
属性?喜欢form.keypreview?
谢谢!
他
" C-Services Holland b.v." < cs*@REMOVEcsh4u.nl> aécritdansle message de
news: 3o********************@zeelandnet.nl ...
Ive Read about the keypreview but i cannot find anything , is that a form
attribute ? like form.keypreview ?
Thanks !
Him
"C-Services Holland b.v." <cs*@REMOVEcsh4u.nl> a écrit dans le message de
news: 3o********************@zeelandnet.nl...
Himselff写道:
Himselff wrote:
伙计们,
我是dot net的新手,想知道我怎样才能像在vb6中一样重拍,在表格中捕捉所有的按键,
每个例子我在表格上寻找一些按键
privete sub form_keypressed(keyascii as integer)
如果keyascii = 13那么''为回车键
调用button_click
私有子FrmMain_KeyPress(ByVal发送者为对象,ByVal e As <系统.Windows.Forms.KeyPressEventArgs)处理MyBase.KeyPress
如果e.KeyChar =" P"或者e.KeyChar =p然后
e.Handled = True
调用BtmProduit_Click(发件人,e)
结束如果
结束sub <什么都没有工作,并且根本不会发生任何事件,因此在查看论坛和互联网之后,我发现没有任何工作,
非常感谢提前!
他
Hi guys,
Im new to dot net and wondering how i could remake the same way i was in
vb6, capture all keypress whitin a form,
per exemple i was on the form looking for some keypress
privete sub form_keypressed(keyascii as integer)
if keyascii = 13 then ''for the enter key
call button_click
end if
end sub
what i got so far in vb .net is :
Private Sub FrmMain_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
If e.KeyChar = "P" Or e.KeyChar = "p" Then
e.Handled = True
Call BtmProduit_Click(sender, e)
End If
end sub
which is not working and dosent fire any event at all, so after looking
the forum and internet, ive found nothing that was working,
Thanks a lot in advance !
Him
你是否将表单的keypreview设置为true?
我也会改变你的如果是这样的话:
如果UCase(e.KeyChar)=" P"然后
- Rinze van Huizen
C-Services Holland bv
Did you set the keypreview setting of the form to true?
Also I''d change your if to something like:
If UCase(e.KeyChar)="P" then
--
Rinze van Huizen
C-Services Holland b.v.
设置表格keypreview属性为true以捕获表单上的所有按键,
即使它们在文本框中,也可以使用keydown进行检查。 fe
如果e.keycode = keys.enter那么
''做东西
结束如果
彼得
" Himselff" < flamontagne@no_spam.polyform.com>在消息中写道
news:ul ************** @ TK2MSFTNGP09.phx.gbl ...
set the form keypreview property to true to capture all keypresses on form,
even if they''re inside a textbox, use keydown to check. fe
if e.keycode = keys.enter then
''do stuff
end if
hth Peter
"Himselff" <flamontagne@no_spam.polyform.com> wrote in message
news:ul**************@TK2MSFTNGP09.phx.gbl...
伙计们,
我是dot net的新手,想知道我是如何以与我在vb6中相同的方式重拍,在一个表单中捕获所有按键,
每个例子我在表格寻找一些按键
privete sub form_keypressed(keyascii as integer)
如果keyascii = 13那么''为回车键
调用button_click
结束如果
Private Sub FrmMain_KeyPress(ByVal sender As Object,ByVal e As
System.Windows .Forms.KeyPressEventArgs)处理MyBase.KeyPress
如果e.KeyChar =" P"或者e.KeyChar =p然后
e.Handled = True
调用BtmProduit_Click(发件人,e)
结束如果
结束sub
这根本不起作用,并且根本没有任何事件发生,所以在看了论坛和互联网的
之后,我发现没有任何工作,
非常感谢提前!
他
Hi guys,
Im new to dot net and wondering how i could remake the same way i was in
vb6, capture all keypress whitin a form,
per exemple i was on the form looking for some keypress
privete sub form_keypressed(keyascii as integer)
if keyascii = 13 then ''for the enter key
call button_click
end if
end sub
what i got so far in vb .net is :
Private Sub FrmMain_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
If e.KeyChar = "P" Or e.KeyChar = "p" Then
e.Handled = True
Call BtmProduit_Click(sender, e)
End If
end sub
which is not working and dosent fire any event at all, so after looking the forum and internet, ive found nothing that was working,
Thanks a lot in advance !
Him
这篇关于表格的受压迫事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!