473,322 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

one more question before i give up

hi yet again (slowly going crazy here),

when i press enter......the keypress event doesn't get fired....anyone has a
clue as for why this is.....i've been looking in MSDN and they do exactly
what I did....and they claim it works??!!

well anyway if anyone has any idea why they keypress event (nor the keydown
event for that matter) doesn't get fired when i press enter???

thanks
Nov 15 '05 #1
10 950
When using text boxes and buttons, the parent form may not receive
keypresses.
There may be some override method for this.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #2
Ok,

So now I put the KeyPress event on all my buttons....and it still works fine
for every key.....except for the enter keystroke
"Morten Wennevik" <Mo************@hotmail.com> schreef in bericht
news:opryffvmvjhntkfz@localhost...
When using text boxes and buttons, the parent form may not receive
keypresses.
There may be some override method for this.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

Nov 15 '05 #3
100
Hi,
KeyPress event is generated only for character keys. *enter* key is not
considered as so.
If you want to catch pressing of *enter* key you have to use KeyDown/Up
events

HTH
B\rgds
100

"dawn" <da******@hotmail.com> wrote in message
news:gC********************@phobos.telenet-ops.be...
hi yet again (slowly going crazy here),

when i press enter......the keypress event doesn't get fired....anyone has a clue as for why this is.....i've been looking in MSDN and they do exactly
what I did....and they claim it works??!!

well anyway if anyone has any idea why they keypress event (nor the keydown event for that matter) doesn't get fired when i press enter???

thanks

Nov 15 '05 #4
100
Hi Morten,
"Morten Wennevik" <Mo************@hotmail.com> wrote in message
news:opryffvmvjhntkfz@localhost...
When using text boxes and buttons, the parent form may not receive
keypresses.
There may be some override method for this.


Set form's *KeyPreview* property to *true*.

HTH
B\rgds
100
Nov 15 '05 #5
it is set to true......and it works fine for every button
(spacebar.....digits...) but NOT for enter
"100" <10*@100.com> schreef in bericht
news:OW*************@TK2MSFTNGP10.phx.gbl...
Hi Morten,
"Morten Wennevik" <Mo************@hotmail.com> wrote in message
news:opryffvmvjhntkfz@localhost...
When using text boxes and buttons, the parent form may not receive
keypresses.
There may be some override method for this.


Set form's *KeyPreview* property to *true*.

HTH
B\rgds
100

Nov 15 '05 #6
I've tried using KeyDown event as well......but it doesn't trigger either
when i press *enter*
"100" <10*@100.com> schreef in bericht
news:ei**************@TK2MSFTNGP12.phx.gbl...
Hi,
KeyPress event is generated only for character keys. *enter* key is not
considered as so.
If you want to catch pressing of *enter* key you have to use KeyDown/Up
events

HTH
B\rgds
100

"dawn" <da******@hotmail.com> wrote in message
news:gC********************@phobos.telenet-ops.be...
hi yet again (slowly going crazy here),

when i press enter......the keypress event doesn't get fired....anyone has
a
clue as for why this is.....i've been looking in MSDN and they do

exactly what I did....and they claim it works??!!

well anyway if anyone has any idea why they keypress event (nor the

keydown
event for that matter) doesn't get fired when i press enter???

thanks


Nov 15 '05 #7
and like i said......on the MSDN page
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwindowsformskeypresseventargsclasstopic .asp

they use KeyPress event to catch *enter*

i'm really puzzled here
"100" <10*@100.com> schreef in bericht
news:ei**************@TK2MSFTNGP12.phx.gbl...
Hi,
KeyPress event is generated only for character keys. *enter* key is not
considered as so.
If you want to catch pressing of *enter* key you have to use KeyDown/Up
events

HTH
B\rgds
100

"dawn" <da******@hotmail.com> wrote in message
news:gC********************@phobos.telenet-ops.be...
hi yet again (slowly going crazy here),

when i press enter......the keypress event doesn't get fired....anyone has
a
clue as for why this is.....i've been looking in MSDN and they do

exactly what I did....and they claim it works??!!

well anyway if anyone has any idea why they keypress event (nor the

keydown
event for that matter) doesn't get fired when i press enter???

thanks


Nov 15 '05 #8
Override ProcessCmdKey in your form.

--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"dawn" <da******@hotmail.com> wrote in message
news:gC********************@phobos.telenet-ops.be...
hi yet again (slowly going crazy here),

when i press enter......the keypress event doesn't get fired....anyone has a clue as for why this is.....i've been looking in MSDN and they do exactly
what I did....and they claim it works??!!

well anyway if anyone has any idea why they keypress event (nor the keydown event for that matter) doesn't get fired when i press enter???

thanks

Nov 15 '05 #9
Forgot the code...

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)

{

if(keyData==Keys.Enter)

{

MessageBox.Show("Enter pressed!");

return true;

}

return base.ProcessCmdKey (ref msg, keyData);

}
--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"dawn" <da******@hotmail.com> wrote in message
news:gC********************@phobos.telenet-ops.be...
hi yet again (slowly going crazy here),

when i press enter......the keypress event doesn't get fired....anyone has a clue as for why this is.....i've been looking in MSDN and they do exactly
what I did....and they claim it works??!!

well anyway if anyone has any idea why they keypress event (nor the keydown event for that matter) doesn't get fired when i press enter???

thanks

Nov 15 '05 #10
Thanks a bunch,

works like a charm now.

Thank GOD!!!! :-)))))
"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> schreef in bericht
news:#k**************@TK2MSFTNGP12.phx.gbl...
Forgot the code...

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)

{

if(keyData==Keys.Enter)

{

MessageBox.Show("Enter pressed!");

return true;

}

return base.ProcessCmdKey (ref msg, keyData);

}
--
Bob Powell [MVP]
C#, System.Drawing

The October edition of Well Formed is now available.
Find out how to use DirectX in a Windows Forms control
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"dawn" <da******@hotmail.com> wrote in message
news:gC********************@phobos.telenet-ops.be...
hi yet again (slowly going crazy here),

when i press enter......the keypress event doesn't get fired....anyone has
a
clue as for why this is.....i've been looking in MSDN and they do

exactly what I did....and they claim it works??!!

well anyway if anyone has any idea why they keypress event (nor the

keydown
event for that matter) doesn't get fired when i press enter???

thanks


Nov 15 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

65
by: perseus | last post by:
I think that everyone who told me that my question is irrelevant, in particular Mr. David White, is being absolutely ridiculous. Obviously, most of you up here behave like the owners of the C++...
9
by: Weekend | last post by:
Currently, i want to develope a multiple choice exam website. The content of the test is store in an XML file. I want to carry out some function. Could you tell me which programming language should...
33
by: John Timbers | last post by:
I'd like to purchase Visual C# .Net for learning purposes only since it's a lot cheaper than Visual Studio (note that I'm a very experienced C++ developer). Can someone simply clarify the basic...
20
by: __PPS__ | last post by:
Hello everybody in a quiz I had a question about dangling pointer: "What a dangling pointer is and the danger of using it" My answer was: "dangling pointer is a pointer that points to some...
7
by: John Salerno | last post by:
Is there a separate ASP.NET newsgroup? I can't find one, and I don't know if it's appropriate here, but I figure it's still written in C# so it's all the same thing anyway. I'm just wondering...
14
by: Mr Newbie | last post by:
I am often in the situation where I want to act on the result of a function, but a simple boolean is not enough. For example, I may have a function called isAuthorised ( User, Action ) as ?????...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
56
by: spibou | last post by:
In the statement "a *= expression" is expression assumed to be parenthesized ? For example if I write "a *= b+c" is this the same as "a = a * (b+c)" or "a = a * b+c" ?
5
by: Wired Hosting News | last post by:
I tried to be breif and give a scenario so as not to be overlooked because it was soooo long. Let me give you real world. I am a manufacturer of goods and produce 11 items that are distributed...
37
by: Prafulla T | last post by:
Assume that an integer pointer x is declared in a "C" program as int *x; Further assume that the location of the pointer is 1000 and it points to an address 2000 where value 500 is stored in 4...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.