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_KeyPres s(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyPressE ventArgs) Handles MyBase.KeyPress
If e.KeyChar = "P" Or e.KeyChar = "p" Then
e.Handled = True
Call BtmProduit_Clic k(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 13 6086
Himselff wrote: 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_KeyPres s(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles MyBase.KeyPress
If e.KeyChar = "P" Or e.KeyChar = "p" Then
e.Handled = True
Call BtmProduit_Clic k(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
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 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*@REMOVEcsh4 u.nl> a écrit dans le message de
news: 3o************* *******@zeeland net.nl... Himselff wrote: 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_KeyPres s(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles MyBase.KeyPress
If e.KeyChar = "P" Or e.KeyChar = "p" Then
e.Handled = True
Call BtmProduit_Clic k(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
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.
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******** ******@TK2MSFTN GP09.phx.gbl... 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_KeyPres s(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles MyBase.KeyPress
If e.KeyChar = "P" Or e.KeyChar = "p" Then
e.Handled = True
Call BtmProduit_Clic k(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
Thats exactly what ive read but where u get the keypreview from ?
when i write form1.keyprevie w it says that i have an error, like :
keypreview is not a member of form1,
any clue ?
Thnaks !
"Peter Proost" <pp*****@nospam .hotmail.com> a écrit dans le message de news:
%2************* ***@TK2MSFTNGP0 9.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******** ******@TK2MSFTN GP09.phx.gbl... 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_KeyPres s(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles MyBase.KeyPress
If e.KeyChar = "P" Or e.KeyChar = "p" Then
e.Handled = True
Call BtmProduit_Clic k(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,
In VBNet you can make an array of the controls that you want to use and with
that tell exactly controls should have that event. Keypress is an event from
control so I think you cannot come in much problems with that. (I thought
that there are controls where that event is hidden so do not think that it
directly works everywhere).
All is typed in this messages not tested so watch errors or typos.
You can make that array like this
\\\
Dim mykeypressctrs as control() = new control() {textbox1, richtextbox1,
textbox2, etc}
///
And than something as this to add the handlers to that.
\\\
For Each ctr As Control In mykeypressctrs
AddHandler ctr.keypress, AddressOf FrmMain_KeyPres s
Next
///
I hope this helps?
Cor
Himselff wrote: Ive Read about the keypreview but i cannot find anything , is that a form attribute ? like form.keypreview ?
Thanks !
Him
If you select your form in the designer, one of the properties is
keypreview.
--
Rinze van Huizen
C-Services Holland b.v.
That part dont realy apply to me cause i want to emulate button click from a
keypress event so all event are handle from form event handler !
I understand the point by the way and i take all in note in case i need it
someday ,
thanks for the info !
"Cor Ligthert" <no************ @planet.nl> a écrit dans le message de news: Ob************* *@tk2msftngp13. phx.gbl... Himselff,
In VBNet you can make an array of the controls that you want to use and with that tell exactly controls should have that event. Keypress is an event from control so I think you cannot come in much problems with that. (I thought that there are controls where that event is hidden so do not think that it directly works everywhere).
All is typed in this messages not tested so watch errors or typos.
You can make that array like this \\\ Dim mykeypressctrs as control() = new control() {textbox1, richtextbox1, textbox2, etc} /// And than something as this to add the handlers to that. \\\ For Each ctr As Control In mykeypressctrs AddHandler ctr.keypress, AddressOf FrmMain_KeyPres s Next ///
I hope this helps?
Cor
When u say newby remember himselff =)
Ive been trough all option of the form in designer and i dont find anything
that look like keypreview, mabe im missing something here ?
Thanks !
"C-Services Holland b.v." <cs*@REMOVEcsh4 u.nl> a écrit dans le message de
news: V4************* *******@zeeland net.nl... Himselff wrote:
Ive Read about the keypreview but i cannot find anything , is that a form attribute ? like form.keypreview ?
Thanks !
Him
If you select your form in the designer, one of the properties is keypreview.
-- Rinze van Huizen C-Services Holland b.v.
By the way i just forget one detail, im developing for a pocket PC windows
CE .net mabe its the reason i dont have the keypreview on my form ?
Him
"Himselff" <flamontagne@no _spam.polyform. com> a écrit dans le message de
news: eb************* ***@tk2msftngp1 3.phx.gbl... When u say newby remember himselff =)
Ive been trough all option of the form in designer and i dont find anything that look like keypreview, mabe im missing something here ?
Thanks ! "C-Services Holland b.v." <cs*@REMOVEcsh4 u.nl> a écrit dans le message de news: V4************* *******@zeeland net.nl... Himselff wrote:
Ive Read about the keypreview but i cannot find anything , is that a form attribute ? like form.keypreview ?
Thanks !
Him
If you select your form in the designer, one of the properties is keypreview.
-- Rinze van Huizen C-Services Holland b.v.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: James Ng |
last post by:
I have posted this to the Citrix Developers' forum and have not heard
anything yet. So I'd like to see if any other Java developers have
experience this problem with their Java application in a Citrix Published
application environment.
We are running Citrix XP enterprise feature release 2 on windows 2000 server
sp4. We developed a Java application which can catch the "PrintScreen" key
event released event correctly in our PC but could...
|
by: Chris |
last post by:
Hi,
I followed the the aricle
http://support.microsoft.com/default.aspx?scid=kb;en-us;321525 and was able
to execute a dts package
in vb.net. I replaced all the "Console.WriteLine" with "msgbox". The problem
I am having is that on my form I added a listbox control
and I created a sub that added entries to the list box
Public Sub addListItems(ByVal sItem As String)
|
by: Chris |
last post by:
Hi,
I would like to reise events when an error occur in my component and
pass the error message to clients consuming the component.
example
Public Function WillFuelContinueToRasie()
|
by: chenedor |
last post by:
hi guys
i ve got a window form to display a message "loading please wait" and
to do a long and big loop.
my problem is i do not know where to put my big loop ?
if i put it in the load event, my form is not displayed...
what is the event fired after the form is fully finished and displayed
?
|
by: active |
last post by:
I have a picturebox usercontrol sitting on a usercontrol. I need a KeyPress
event in the PictureBox.
I suppose I could have a property in the pictureBox that is accessed by a
call in a KeyPressed event in the UserControl. Right?
Kind of kludge - is there a more direct way? The usercontrol needs no
KeyPress event at all and the Picturebox needs them all.
| |
by: Rob |
last post by:
When a custom control is used within a form, that control does not get
events directly. I've run into this a couple times with both mouse
and keyboard events.
Ex: A custom control inherits from UserControl (or Panel, etc). If
that particular control is being edited, it IS possible to assign
handlers and get events.
However, when the control is used on the main form, assigning a
handler to the particular control does nothing--the...
|
by: JDeats |
last post by:
If you create a new C# Windows Application project in Visual
Studio.NET 2003 or 2005 and proceed to.
1. Make default form size 800x600
2. Drop a CheckBoxList control and dock it to the left
3. Drop a webBrowser control and dock it to the top
4. Drop a panel control and dock it to fill
Make the web browser about 60% of the form height height and make the
panel control about 40% of the height.
|
by: Luzuko |
last post by:
Hi mates,
I have written the code below on VB 2005 to try and restrict input on a textbox.
This code works very well on VB 2005 and its controls.
However my project's User interface (controls) are developed using Microsoft expression Blend and then I import the interface on VB 2005 and start coding.
Everything works well, however the code below does not work simply because the keyPress event is not available for my User interface.
So...
|
by: GS |
last post by:
I was trying to catch the control enter key sequence of a combo box in the
keydown event, but I failed to se anything like control enter, neither Did I
find in keypresssed event
I tried google but no luck
Do I have to go down to the level of capturing control keydown/press with
time and then when enter key is pressed check the time? or is there some
easier way?
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |