473,394 Members | 1,766 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,394 software developers and data experts.

Problems with KeyPress

Hi all! I was just messing around with something that I
wrote in VB 6.0 and ran into a problem. In case any you
of you have read my post of boolean, its back to that
same calculator. I wanted to design it in such a way that
if a user presses enter then it takes it as the person
has chosen to use the = sign. The problem is that when
the Form was selected I had pressed enter and now for
some unknown reason, without any code that specifies
whether the key pressed is the Enter key or not, if I
have pressed any button followed by the Enter key, that
same button is pressed again.
The english in that last sentence is quite bad let me
give an example!
If I click on 7 and then press enter the display will
show another 7 in the box which is something that I dont
want.

Any ideas as to how I can get rid of this without having
to do it all over again!!??

Thanks a lot

Nov 20 '05 #1
2 862
Cor
Hi Mehul,
Probably you have somewhere a routine that goes like this in pseudo code

If key = 0 to 9
value = key.value
end if
textbox= oldtextboxvalue + value

To overcome that, start with cleaning the value always or make this

if key = 1 to 9
value = key.value
else
value = 0
end if

I hope I was guessing right and send else some code?

Cor

Hi all! I was just messing around with something that I
wrote in VB 6.0 and ran into a problem. In case any you
of you have read my post of boolean, its back to that
same calculator. I wanted to design it in such a way that
if a user presses enter then it takes it as the person
has chosen to use the = sign. The problem is that when
the Form was selected I had pressed enter and now for
some unknown reason, without any code that specifies
whether the key pressed is the Enter key or not, if I
have pressed any button followed by the Enter key, that
same button is pressed again.
The english in that last sentence is quite bad let me
give an example!
If I click on 7 and then press enter the display will
show another 7 in the box which is something that I dont
want.

Any ideas as to how I can get rid of this without having
to do it all over again!!??

Thanks a lot

Nov 20 '05 #2
Make sure that Form's KeyPreview property is set to 'True'. Also don't
forget to put e.Handled = True in your Form_Keypress event handler.

"Mehul Malhotra" <me************@yahoo.com> wrote in message
news:0c****************************@phx.gbl...
Hi all! I was just messing around with something that I
wrote in VB 6.0 and ran into a problem. In case any you
of you have read my post of boolean, its back to that
same calculator. I wanted to design it in such a way that
if a user presses enter then it takes it as the person
has chosen to use the = sign. The problem is that when
the Form was selected I had pressed enter and now for
some unknown reason, without any code that specifies
whether the key pressed is the Enter key or not, if I
have pressed any button followed by the Enter key, that
same button is pressed again.
The english in that last sentence is quite bad let me
give an example!
If I click on 7 and then press enter the display will
show another 7 in the box which is something that I dont
want.

Any ideas as to how I can get rid of this without having
to do it all over again!!??

Thanks a lot

Nov 20 '05 #3

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

Similar topics

3
by: Darryn Ross | last post by:
Hi, I am trying to catch the KeyPress event on my datagrid but it isn't working... i have also tried registering the handler with the event like this... dgGLBatch.KeyPress += new...
2
by: rege | last post by:
Hi, I have two applications developed in C# say A and B. When user presses key "L" with applicaition A active , it causes a keypress event which causes application B to run. Application A then...
5
by: ross kerr | last post by:
Hi All, I am extending the combobox to create a control that selects an item based on the text the user is typing into the text area of the control. I have an issue that occurs only when i...
4
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
3
by: Fia | last post by:
Hi In Visual Basic 6 I could call keypress with an integer of a choosen key. For example I could call a textbox's keypress with the number 13 (for the enter key). But now in Visual Basic .Net I...
5
by: Henry Jones | last post by:
I am new to C# and wanted to capture the KeyPress for a textbox. I created some code as follows: private void textBox3_KeyPress(object sender, System.EventArgs e) { this.textBox2.Text =...
7
by: JV | last post by:
I am running a large Access 2000 application (installed using Access Runtime) that uses many VB SendKeys, primarily to expand combo boxes On Enter. When trying to run it on Vista I get a...
2
by: Tony Johansson | last post by:
Hello! I have created a Control that consist of a label and a textbox.I have called this class ctlLabelTextbox. public partial class ctlLabelTextbox : UserControl { .... } The class that I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
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,...
0
jinu1996
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...

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.