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

Show Dialig boxes with key_press or key_down event

hi
I'm working on a windows application form , I need to show dialog boxes by clicking a key on the keyboard , how can I do taht ?
Mar 25 '08 #1
2 1419
debasisdas
8,127 Expert 4TB
You need to handle the keystroke on Keydown / KeyPress event of particular control.
Mar 25 '08 #2
!NoItAll
297 100+
First turn the forms KeyPreview property to True. This means the keydown event in the form will always see any keystroke. Without this you would have to check the keydown event in every control on the form - and it isn't practical to do this.

Next - in the form you will find a keydown event. Keydown is receives more keystrokes than keypress. Keydown is the best place to check for the key you want. The values to test here are a bit cryptic - so the best way is to put a break point in here and look at the value of the keystroke return when you press the key you want.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim iKey as Integer

iKey = KeyCode 'run the form and test this for the keyvalue you want

'then when you know the key you want use this code here
If iKey = iKeyIWant then
'do what you want
End if

End Sub

Again - make sure the KeyPreview property of the form is TRUE.
Mar 26 '08 #3

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

Similar topics

2
by: louissan | last post by:
Hi all, I have a slight problem with IE, when everything works with firefox. The goal is to _create_ boxes using the createElement method. And then making it draggable with the mouse. The code...
2
by: Ben | last post by:
My current project requires me to create part of a form that is created on the fly. The project consists a list of entries to an event. The name and address and such is easy. The design is detup so...
15
by: Paul T. Rong | last post by:
Hi everybody, This time a very very difficult case: I have a table "tblStudent", there are 50 students, I also made a form "frmStudent" based on "tblStudent", now if I don't want to show all...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
4
by: Greg | last post by:
I have a big problem. I have two text boxes each with their own own button. Buton1 is for Textbox1 and Button2 is for Textbox2. Here's the problem, if someone enters something into Textbox1, then...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
1
by: padmanpatel | last post by:
hello friends, i want to create a key_press event in web application .. pzl help me...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.