I'm very new to visual basic and i'm currently using Visual Basic 6. I've been trying to figure out how to make things happen when you press an arrow key. I've tried a few differant ways but for some reason I cannot get it to work. I don't want to use anything to advanced since I'm only a freshmen in highschool and were only halfway through the year. (My teacher goes so slow were still on For Next and Do While loops.) Any help would be appreciated.
6 2127
I'm very new to visual basic and i'm currently using Visual Basic 6. I've been trying to figure out how to make things happen when you press an arrow key. I've tried a few differant ways but for some reason I cannot get it to work. I don't want to use anything to advanced since I'm only a freshmen in highschool and were only halfway through the year. (My teacher goes so slow were still on For Next and Do While loops.) Any help would be appreciated.
You could try setting the form's KeyPreview property (to make sure the form sees the keys before any controls do), then use the KeyDown or KeyUp event.
You could try setting the form's KeyPreview property (to make sure the form sees the keys before any controls do), then use the KeyDown or KeyUp event.
in Keydown use keycode to check
in keypress use keyascii to check
Remember theh key TAB is not get tressed in any event
in keyascii arrow keys are not get tressed
bye
in Keydown use keycode to check
in keypress use keyascii to check
Remember theh key TAB is not get tressed in any event
in keyascii arrow keys are not get tressed
That's not entirely true, though for practical purposes it's close enough.
The Tab key can be detected in both the KeyDown and KeyPress events. The code is 9 (or vbKeyTab) in both cases. Unfortunately, this seems to apply only to an empty form. Once you place a control on the form, it appears to absorb the KeyPress, but KeyDown is still triggered. If you place more than one control (and let's face it, when wouldn't you?) then it becomes undetectable. What a pain.
And yes, as you say vijaydiwakar, the arrow keys only show up in the KeyDown and KeyUp events, not KeyPress.
That's not entirely true, though for practical purposes it's close enough.
The Tab key can be detected in both the KeyDown and KeyPress events. The code is 9 (or vbKeyTab) in both cases. Unfortunately, this seems to apply only to an empty form. Once you place a control on the form, it appears to absorb the KeyPress, but KeyDown is still triggered. If you place more than one control (and let's face it, when wouldn't you?) then it becomes undetectable. What a pain.
And yes, as you say vijaydiwakar, the arrow keys only show up in the KeyDown and KeyUp events, not KeyPress.
do u have any idea how to tress the tab key when a no of ctrls are placed on the form
do u have any idea how to tress the tab key when a no of ctrls are placed on the form
Can we just clarify what you mean by "tress", please?
Definition of TRESS: braid: a hairdo formed by braiding or twisting the hair
And no, sorry, I don't know how to tell when the user hits the Tab key. If someone else does, I'd be curious to find out.
Can we just clarify what you mean by "tress", please?
Definition of TRESS: braid: a hairdo formed by braiding or twisting the hair
And no, sorry, I don't know how to tell when the user hits the Tab key. If someone else does, I'd be curious to find out.
thanx for compliments
Sign in to post your reply or Sign up for a free account.
Similar topics
by: skipc |
last post by:
Hi,
I am stuck... I've got a popup window that displays a list in table
format with links on the bottom to navigate the list <prev> 1 2 3 ...
<next>
When I demo'd to the users... they...
|
by: Darren Oakey |
last post by:
ok - the problem - I made a simple breakout game out of a form, just
painting the background - and using keydown for left and right arrow keys to
control the bat - worked fine.
I then moved all...
|
by: Neil Wallace |
last post by:
Hi there,
I have an application in which a grid of 100 or more buttons are put on a
form in columns of 10.
All the buttons are within a panel.
They are added in runtime, and so they adopt a...
|
by: Rlrcstr |
last post by:
How can you detect when an arrow key gets pressed? Doesn't seem to trigger
a KeyPress or KeyDown event. Thanks.
Jerry
|
by: Vincent |
last post by:
Hi,
I have a user control that needs to trap the arrow keys to move items
around internally. However, using the arrow keys will move the focus to
another control on the form hosting the user...
|
by: Martijn Mulder |
last post by:
/*
I have problems detecting the Arrow Keys on a User Control. A control
derived from System.Windows.Forms.Control neglects 'bare' Arrow Keys
but does react on the combination <Altor <Ctrl+ Arrow...
|
by: Martijn Mulder |
last post by:
/*
I override IsInputKey() to direct the Arrow Keys (Cursor Keys) to my
custom System.Windows.Forms.Control. But, holding down the Shift-Key
prevents the Arrow Keys from coming through.
How can...
|
by: boopsboops |
last post by:
Hi thescripts people, I hope I'm in the right forum for Visual Basic Dotnet (VS 2005).
I am trying to make a custom control in which you can nudge a point around using the arrow keys. Actually,...
|
by: Charles Law |
last post by:
I'll kick myself when you tell me, but ...
I have a user control on a form, and I want the user control to see the
arrow keys when I press them. If I press just about any other key the
control's...
|
by: beary |
last post by:
Hi
Being tested using FF 3 on WAMP server. I have spent a number of hours trying to figure this out myself.
I have a html form using table cells and had a request to enable the arrow keys on a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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,...
|
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,...
|
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: 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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
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...
| |