|
|
|
| Author Details |
|---|
| All Tutorials by interviewmyass |
1
|
|---|
Key trapping
How do you tell what keys your users are pressing? This tutorial teaches you a rock solid method that you can build in games and advanced applications.
This is extremely easy. Firstly open a new form, or the form that you would like to catch the key presses on.
We can then declare a new procedure:
Code
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'space for your code
End Sub
Now this is the only tricky bit, (if you have no understanding of computers what-so-ever). When you press the letter "d" on the keyboard, you are not sending "d" to the comptuer, you are sending a number. Every key on your keyboard has it own, unique, number.
So if I wanted to find out what the key of anything is, I made a form that would tell me. Whenever I pressed a key, it would set the .text property of a disabled input field to the keycode value.
| | Hits:609 Rate: 4.0(out of 5) Vote:1 Submit Date :2006-03-27 Rate It | Error | Review | | | Category: Home > Visual Basic > Introduction to Visual Basic |
|
|
|---|
The Basics of Visual Basic
A great tutorial for people that are starting out with visual basic and need to get a rock solid start. Described are loops, conditionals and variables.
Okay, Visual Basic.. what an application. Its so simple to get programs up and running (usually a point, click, drag, type and run =D).
Variables
Variables in VB are declared with the dimension keyword..
Code
Dim variable_name as string
..also you will notice that after the "Dim", then the name there is an "as string" statement. This means that the variable that I declared is of variable type string. This is basically some text. Some other variable types include integer, double, currency, boolean, etc.
Conditionals
The IF statement can help you tell if the a value is equal to something, or not.
| | Hits:466 Rate: 0.0(out of 5) Vote:0 Submit Date :2006-03-27 Rate It | Error | Review | | | Category: Home > Visual Basic > Introduction to Visual Basic |
|
|
|---|
Key trapping
Key trapping
How do you tell what keys your users are pressing? This tutorial teaches you a rock solid method that you can build in games and advanced applications.
Now this is the only tricky bit, (if you have no understanding of computers what-so-ever). When you press the letter "d" on the keyboard, you are not sending "d" to the comptuer, you are sending a number. Every key on your keyboard has it own, unique, number.
So if I wanted to find out what the key of anything is, I made a form that would tell me. Whenever I pressed a key, it would set the .text property of a disabled input field to the keycode value.
| | Hits:83 Rate: 0.0(out of 5) Vote:0 Submit Date :2006-03-27 Rate It | Error | Review | | | Category: Home > Visual Basic > Introduction to Visual Basic |
|
|
|
|
|
|
|
|