Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET
Go Back  Xtreme Visual Basic Talk > > > Looking for a joystick example in VB .NET


Reply
 
Thread Tools Display Modes
  #1  
Old 12-01-2005, 01:34 PM
bmilano's Avatar
bmilano bmilano is offline
Regular
 
Join Date: Dec 2004
Posts: 82
Question Looking for a joystick example in VB .NET


Hi,

Does anyone have an example of use of a joystick in VB .NET or know where to find one?

DirectInput or not...it doesn't matter. I'm just trying to use a USB joystick within my program. I don't care how I do it.

Thanks,
Bill
Reply With Quote
  #2  
Old 12-01-2005, 04:25 PM
jo0lsLooking for a joystick example in VB .NET jo0ls is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Feb 2005
Location: London
Posts: 1,050
Default

Here you go, its a translation of the c# 2003 example from the October directX SDK into vb.net 2003.
Attached Files
File Type: zip vb joystick.zip (10.9 KB, 1245 views)
Reply With Quote
  #3  
Old 12-03-2005, 03:17 PM
bmilano's Avatar
bmilano bmilano is offline
Regular
 
Join Date: Dec 2004
Posts: 82
Thumbs up Perfect!

jo0ls,

That was EXACTLY what I was looking for. Thanks a lot.

Bill
Reply With Quote
  #4  
Old 09-21-2008, 05:16 AM
bintuch bintuch is offline
Newcomer
 
Join Date: Sep 2008
Posts: 1
Default

Hi, this code doesn't work with Visual Studio 2005. What do I need to do in order to make it work?
Reply With Quote
  #5  
Old 03-07-2009, 09:57 PM
mattmannz mattmannz is offline
Newcomer
 
Join Date: Feb 2009
Posts: 1
Default multiple joysticks

Hey. That example is awesome. The issue I am having is how can you make it work with 2 joysticks. Ive been doing a little tweak of the code of the example, but i have had no luck. Help please. Thanks
Reply With Quote
  #6  
Old 09-02-2009, 08:31 PM
DennisHarding DennisHarding is offline
Newcomer
 
Join Date: Jun 2009
Posts: 1
Default

Thanks jo0ls, That was perfect. mattmannz, thats what I'll be working on next myself.
Reply With Quote
  #7  
Old 09-15-2009, 12:31 PM
jaap newbie jaap newbie is offline
Junior Contributor
 
Join Date: Feb 2004
Posts: 234
Default

Thanks for this great example . I still have got one question:

How do you know which button is pressed? The proble is every button I press gives "00" except the correct button number.

Now this code is used to see if a button is pressed:

Code:
' Fill up text with which buttons are pressed
        Dim buttons As Byte() = state.GetButtons()

        Dim _button As Integer = 0
        For Each b As Byte In buttons
            If Not ((b And &H80) = 0) Then
                strText += _button.ToString("00 ")
                _button += 1
            End If	
        Next

        labelButtons.Text = strText
I use VB .Net 2008 express edition.

Thanks in advance

Last edited by jaap newbie; 09-15-2009 at 01:11 PM.
Reply With Quote
  #8  
Old 09-16-2009, 01:55 PM
jaap newbie jaap newbie is offline
Junior Contributor
 
Join Date: Feb 2004
Posts: 234
Default

Ok check this thread if you want to see what button is pressed.

http://www.xtremevbtalk.com/showthre...76#post1341976
Reply With Quote
  #9  
Old 06-01-2010, 05:39 PM
convoluted2k8 convoluted2k8 is offline
Newcomer
 
Join Date: Jun 2010
Posts: 1
Default

Sorry to bump an old thread. I'm trying to get code from jo0ls to work in Visual Basic .Net 2010 but I'm getting the following error:

FileLoadException was unhandled
Mixed mode assembly is built against version v1.1.4322 of the runtime and cannot be loaded in the 4.0 runtime without adding additional configuration information.

Anyone know how to solve this issue? Thanks in advance
Reply With Quote
  #10  
Old 06-01-2010, 06:16 PM
AtmaWeapon's Avatar
AtmaWeaponLooking for a joystick example in VB .NET AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

The code is years old and written against MDX assemblies that were compiled against .NET 1.1. The 1.1 CLR is incompatible with other versions. There *might* be 2.0 versions of the MDX assemblies available that would work with VS 2010, but Microsoft has discontinued support for Managed DirectX in favor of XNA. Part of the reason is that the MDX libraries had many memory and performance-related problems. I think the latest version of DirectX they supported was 8 or maybe 9, so they're quickly getting out of date.

This leaves you with a few choices:
  • Acquire a version of Visual Basic 2003 and deal with the problems. You'll be fighting a lot of battles and most .NET sample code will be useless to you as it will use types and techniques introduced in 2.0 or later.
  • Try to find 2.0 versions of the MDX libraries and reference those. You'll still have to deal with some problems, but at least you'll find more useful samples.
  • Move to XNA; this practically requires C# for some reason.
  • Go the OpenGL route and have a look at the Tao framework. (This also tends to be C# heavy.)
To me, the most compelling choice is XNA so long as your goal is games.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #11  
Old 06-02-2010, 02:07 PM
jaap newbie jaap newbie is offline
Junior Contributor
 
Join Date: Feb 2004
Posts: 234
Default

I had the same problem when switching to vb.net 2010.

I've found this code and it worked for me:

http://stackoverflow.com/questions/1...e-net-4-config

You need to put it into the assembly file.

Cheers.
Reply With Quote
  #12  
Old 06-03-2010, 10:42 PM
xenon2k8 xenon2k8 is offline
Newcomer
 
Join Date: May 2010
Posts: 1
Default

Thanks! Jaap, that was very useful, I had the same issue! I also have a request. Is there any way to convert from DirectInput polling to a event-driven scheme in the code provided by jo0ls? It seems that polling is rather resource intensive and I would like to get away from that is possible.
Reply With Quote
  #13  
Old 06-04-2010, 10:06 AM
AtmaWeapon's Avatar
AtmaWeaponLooking for a joystick example in VB .NET AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

I tried to help with creating an event-driven scheme in this thread, but I don't knwo that jaap_newbie ever got it working. I don't have DirectX installed or a gamepad to test with so I can't give it a go.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET
 
Looking for a joystick example in VB .NET
Looking for a joystick example in VB .NET
 
-->