473,399 Members | 4,254 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,399 software developers and data experts.

Key press event

49
Hi All,

I am trying to use the key combination to perform a specific task, at present I have developed a windows mobile/smartphone application using the key 5, when I press key 5 it gives me some stored information into the textboxes.

I want to use the key combination # and 5 to get the information into the textboxes.

please, suggest me the way to do it.

Thanks in advance

LTCCTL
Mar 10 '08 #1
7 2307
markmcgookin
648 Expert 512MB
Hi All,

I am trying to use the key combination to perform a specific task, at present I have developed a windows mobile/smartphone application using the key 5, when I press key 5 it gives me some stored information into the textboxes.

I want to use the key combination # and 5 to get the information into the textboxes.

please, suggest me the way to do it.

Thanks in advance

LTCCTL
I would put the event handler for 5 in the onPress event for # .... and remove it once they have stopped pressing # ... so the event for 5 is only going to be caught when the # key is down.... would that help?
Mar 10 '08 #2
LTCCTL
49
I would put the event handler for 5 in the onPress event for # .... and remove it once they have stopped pressing # ... so the event for 5 is only going to be caught when the # key is down.... would that help?

Thanks for suggesting me the way to do it.

I have used the key down event and tried to use the if condition to catch both the key press events, but it is giving me error, may be I am doing it wrong.

could you please let me know, how exactly it works?

Thanks and Regards
LTCCTL
Mar 13 '08 #3
markmcgookin
648 Expert 512MB
Thanks for suggesting me the way to do it.

I have used the key down event and tried to use the if condition to catch both the key press events, but it is giving me error, may be I am doing it wrong.

could you please let me know, how exactly it works?

Thanks and Regards
LTCCTL
Can you post the error please?
Mar 13 '08 #4
LTCCTL
49
Can you post the error please?

Hi,

I have taken 2 boolean variables, in the key down events of # and 5, it will be set to true and if both of them are true then the information will be shown in the textboxes.

Now the problem is whenever I press # or 5, the information is shown in the textboxes.

I am using I-mate, in that to get access to # and 5 we have to press the shift key, when I press shift key then keydown event of shift is fired.

Should I take another variable to store the shift keydown event?

the code is given below:

public bool kp, kp1;

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == System.Windows.Forms.Keys.D5))
{
kp = true; //5
}
else
{
kp = false;
}
if ((e.KeyCode == System.Windows.Forms.Keys.F9))
{
kp1 = true; //#
}
else
{
if (kp1!=true )
{
kp1 = false;
}
}
if (kp1 == true)
{
if (kp == true)
{
label1.Text = "# & 5 keys are pressed";
}
}
}

please let me know what mistake I am making
Mar 14 '08 #5
LTCCTL
49
Can you post the error please?

Hi,

I have taken 2 boolean variables, in the key down events of # and 5, it will be set to true and if both of them are true then the information will be shown in the textboxes.

Now the problem is whenever I press # or 5, the information is shown in the textboxes.

I am using I-mate, in that to get access to # and 5 we have to press the shift key, when I press shift key then keydown event of shift is fired.

Should I take another variable to store the shift keydown event?

the code is given below:

public bool kp, kp1;

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == System.Windows.Forms.Keys.D5))
{
kp = true; //5
}
else
{
kp = false;
}
if ((e.KeyCode == System.Windows.Forms.Keys.F9))
{
kp1 = true; //#
}
else
{
if (kp1!=true )
{
kp1 = false;
}
}
if (kp1 == true)
{
if (kp == true)
{
label1.Text = "# & 5 keys are pressed";
}
}
}

please let me know what mistake I am making

Thanks & Regards
LTCCTL
Mar 14 '08 #6
markmcgookin
648 Expert 512MB
Hi,

I have taken 2 boolean variables, in the key down events of # and 5, it will be set to true and if both of them are true then the information will be shown in the textboxes.

Now the problem is whenever I press # or 5, the information is shown in the textboxes.

I am using I-mate, in that to get access to # and 5 we have to press the shift key, when I press shift key then keydown event of shift is fired.

Should I take another variable to store the shift keydown event?

the code is given below:

public bool kp, kp1;

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == System.Windows.Forms.Keys.D5))
{
kp = true; //5
}
else
{
kp = false;
}
if ((e.KeyCode == System.Windows.Forms.Keys.F9))
{
kp1 = true; //#
}
else
{
if (kp1!=true )
{
kp1 = false;
}
}
if (kp1 == true)
{
if (kp == true)
{
label1.Text = "# & 5 keys are pressed";
}
}
}

please let me know what mistake I am making

Thanks & Regards
LTCCTL
Are you developing this in Visual Studio? Have you tried using breakpoints during debug mode to find out some more about what events are being fired and when?

Mark
Mar 14 '08 #7
LTCCTL
49
Are you developing this in Visual Studio? Have you tried using breakpoints during debug mode to find out some more about what events are being fired and when?

Mark

Hi Mark,

Thanks for your help and suggestions I have done it.

Regards
LTCCTL
Apr 17 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mukesh | last post by:
Hi I have a datagrid in which i want to capture the key press event and find which row i am in. Tried with the key press event provided by datagrid, but it does not fire. What could be wrong ...
8
by: dixie | last post by:
I want to run an event when I press the Ctl key simultaneously with the K key. How do I achieve this in VBA? dixie
6
by: guoqi zheng | last post by:
In a regular html form, when user press "enter" key, the form will be submitted. However, in ASP.NET web form, a form will only be submitted (post back) when a special button is clicked. Many...
3
by: raj | last post by:
hi, i have one textbox and one save button, i have added attribute at page load event btnSave.Attributes.Add("onclick","return ValidateForm();"); in validationform() ,I have written like this...
6
by: Rado | last post by:
Hello. In Event key_press I write If e.KeyChar = Microsoft.VisualBasic.Chr(127) Then Asci 127 is key DELET. But it doesn't work, when I get other Ascii It's ok. And When I press...
22
by: Ricky W. Hunt | last post by:
First, the subject probably doesn't use the correct terms but I'm not sure what it's called in VB. I'm writing a media player app. The subroutine that handles the "open file" button contains an...
1
by: donald | last post by:
I got a ASP.net text box called textbox1 and a label called label1. When a key is press in a text box i want it to up date the label with what is in the textbox. Label1.Text = TextBox1.Text; ...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
1
by: =?Utf-8?B?QXNhZg==?= | last post by:
Hello, I have a Default.aspx page with several controls in a Master Page. When pressing on a Button control Page_Load event is fired on the Default.aspx page and after that the Page_Load event...
3
by: win | last post by:
How to get the keycode press in a web form Vincent
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
agi2029
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,...
0
isladogs
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...

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.