Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Tutorial: Visual Basic .NET] Multi-Key Keyboard Input
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Gooie




PostPosted: Mon Jan 21, 2008 9:36 pm   Post subject: [Tutorial: Visual Basic .NET] Multi-Key Keyboard Input

[For Visual Basic .NET]

This is my first tutorial so bare with me. I noticed how dead the Visual Basic Section is. I think we just need more content. So anyway, you may have noticed if you have worked with Visual Basic.NET for any amount of time. That keyboard input is not fun. It's because it only checks one key at a time. This really sucks if you want to make a game. So, Here is how you get around it.

First you need to put this after your Public Class.

code:
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal keyCode As Integer) As Short


This sets up input for the command 'GetAsyncKeyState()'.

That is pretty much all you need, that command checks the keys state when you want it to, rather than one at a time. So, if you want to check for the input you could try:

code:
If GetAsyncKeyState(83) Then
     ' Do your stuff here.
End If

83 being the S key.

The down side is you will need to use key codes. There is a list here.
I hope that was acceptable, enjoy!
Sponsor
Sponsor
Sponsor
sponsor
CodeMonkey2000




PostPosted: Mon Jan 21, 2008 9:48 pm   Post subject: RE:[Tutorial: Visual Basic .NET] Multi-Key Keyboard Input

How different is .NET from VB6?
Gooie




PostPosted: Mon Jan 21, 2008 9:52 pm   Post subject: Re: [Tutorial: Visual Basic .NET] Multi-Key Keyboard Input

I couldn't tell you. I just started learning Visual Basic .NET a week ago. Haven't gotten in to Visual Basic 6 yet.
CodeMonkey2000




PostPosted: Mon Jan 21, 2008 9:53 pm   Post subject: RE:[Tutorial: Visual Basic .NET] Multi-Key Keyboard Input

Ah. Our school bought .NET, but we still use VB6 Razz
Gooie




PostPosted: Mon Jan 21, 2008 10:00 pm   Post subject: Re: RE:[Tutorial: Visual Basic .NET] Multi-Key Keyboard Input

CodeMonkey2000 @ January 21st, 9:53 pm wrote:
Ah. Our school bought .NET, but we still use VB6 Razz


Yeah, same... I really want to use VB.NET, but my teacher is against it for some reason or another. I so, I'll need to learn both. Neither look difficult. So it should be child's play. Razz
CodeMonkey2000




PostPosted: Mon Jan 21, 2008 10:23 pm   Post subject: RE:[Tutorial: Visual Basic .NET] Multi-Key Keyboard Input

The only reason I use VB is because that's all they teach. If I were you I would stay clear of VB, and only use it for school purposes. There are better languages you can teach yourself Very Happy
Gooie




PostPosted: Mon Jan 21, 2008 10:40 pm   Post subject: Re: [Tutorial: Visual Basic .NET] Multi-Key Keyboard Input

Yeah, I want to find a good one to learn, but I can't make up my mind. I figured I stick somewhat to curriculum until i figure it out.
stevejack




PostPosted: Mon Sep 14, 2009 6:31 am   Post subject: Re: [Tutorial: Visual Basic .NET] Multi-Key Keyboard Input

I want to use VB.Net How to work with Multi-Key Keyboard Input how work with this in Visual Basic and only use it for school purposes. There are better languages can teach yourself.
Thank you.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: