Well, How do i bind a key in Vb6.0? and, i have searched.
13 5487
Well, How do i bind a key in Vb6.0? and, i have searched.
hi
what key did you have in mind, and bind to what?
hi
what key did you have in mind, and bind to what?
Lets say, W to - form1.Backcolor = qbcolor (15)
?
Lets say, W to - form1.Backcolor = qbcolor (15)
?
hi
tak e.g: -
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
-
If KeyCode = vbKeyF2 Then Form1.BackColor = QBColor(15)
-
End Sub
-
you may chose any key (see MSDN help on KeyDown)
It wont work.
It will work if you apply the code to the first control that receives the focus when you start your app. This will be the control with a tab index of 0
It will work if you apply the code to the first control that receives the focus when you start your app. This will be the control with a tab index of 0
hi
of course should it be
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyW Then Form1.BackColor = QBColor(15)
End Sub
how stupid to assign F2 to the color white ... :(
It will work if you apply the code to the first control that receives the focus when you start your app. This will be the control with a tab index of 0
I don't get it, would you explain it a little bit easier for me ,as i am new to vb.
And Albert, it still doesnt work.
I don't get it, would you explain it a little bit easier for me ,as i am new to vb.
And Albert, it still doesnt work.
In design view set the KeyPreview property of your form to true
Then Albert's code will work
In design view set the KeyPreview property of your form to true
Then Albert's code will work
sry, will explain ...
Create a form (usually the name will be Form1 if you don't change it)
then doubleclick in your newly made form --> a new (blank) screen will open with statement Sub Form_Load()
in righthand top corner you find a dropdown listbox -- select here:
KeyDown
Now a new sub will be opened called Form_KeyDown(....
paste the previous code inhere
beware not to use sub Form_KeyDown and End Sub twice
now, when you start your project (F5) the program will rub, doing NOTHING untill you press the key W, then your form should turn pale
sry, will explain ...
Create a form (usually the name will be Form1 if you don't change it)
then doubleclick in your newly made form --> a new (blank) screen will open with statement Sub Form_Load()
in righthand top corner you find a dropdown listbox -- select here:
KeyDown
Now a new sub will be opened called Form_KeyDown(....
paste the previous code inhere
beware not to use sub Form_KeyDown and End Sub twice
now, when you start your project (F5) the program will rub, doing NOTHING untill you press the key W, then your form should turn pale
ah, now it works. But how do i add more bindings?
ah, now it works. But how do i add more bindings?
Hi,
To add more key bindings, you can do like this... -
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
-
Select Case KeyCode
-
Case vbKeyW
-
BackColor = QBColor(15)
-
Case vbKeyF
-
ForeColor = QBColor(5)
-
Case vbKeyM
-
MsgBox "Added more keys...", vbInformation
-
End Select
-
End Sub
-
Regards,
M.Sivadhas.
THanks, but just one more question, how do i deselect a thing? Like if i would wanna type in something, then press enter too remove it. But now it select the text box and nothing happens when you press enter, except the ding. so, now i want it too deselect the text box when i press enter. Hope you understand.
THanks, but just one more question, how do i deselect a thing? Like if i would wanna type in something, then press enter too remove it. But now it select the text box and nothing happens when you press enter, except the ding. so, now i want it too deselect the text box when i press enter. Hope you understand.
hi
about the same procedure
select your object
doubleclick
then select in the right upper corner e.g: click / doubleclick or KEYDOWN -
-
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
-
'--- clear text when hitting Enter
-
If KeyCode = vbKeyReturn Then Text1.Text = vbNullString
-
'--- clear text when hitting Backspace
-
If KeyCode = vbKeyBack Then Text1.Text = vbNullString
-
End Sub
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Clarence Gardner |
last post by:
I've got a problem that I don't see how to program around. A socket server
that was running fine, today started getting an exception from the bind()
call (errno 22, Invalid argument) and yet the...
|
by: Achille Carette |
last post by:
Hello all,
I noticed a difference in the explain plans between JDBC using bind
variables (PreparedStatement) and SQLPlus for the same query. The query made
through JDBC using bind variables...
|
by: P G |
last post by:
I hope this is on topic here. I have a problem compiling a simple
example of the use of boost::bind. Please take a look at the program
below.
...
|
by: Arturo Cuebas |
last post by:
The program below contains a compile error. Following the program you
will find the typical fix then my idea for a library that facilitates
a more elegant fix.
#include <boost\bind.hpp>
using...
|
by: IndyStef |
last post by:
I am trying to use boost's bind on a member function, on the VC8
compiler.
After using several different attempts, I could not get it to work.
Does
anybody know what is wrong with the code below?...
|
by: teclioness |
last post by:
Hi,
I am using gridview for the user to update rows. In a row, there sre
two columns, which need to be updated. When the gridview is to be
shown, the row should show the values from database....
|
by: Tigera |
last post by:
Greetings,
I am trying to learn to use the Boost library, and I've run into a
frustrating problem with the line marked here:
#include <boost/function.hpp>
#include <boost/functional.hpp>...
|
by: crack.the.hack |
last post by:
Hi All,
If I am changing the database machine, what should I do not to prep
bind the sqc files everytime.
Because I need to build my application everytime the database is
changed?
Is there...
|
by: oranoos3000 |
last post by:
hi
i read about bind jqeury method
general syntax as follow as
bind(eventType,data,listener)
Establishes a function as the event handler for the specified event type on all elements in...
|
by: victor deng |
last post by:
I update db2v8 with new fix18,
and do db2 "bind /home/test1/sqllib/bnd/@db2ubind.lst BLOCKING ALL GRANT PUBLIC ACTION ADD".
Most of the packages already exist ,so it most errors do not matter.
But...
|
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: 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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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: 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |