Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

US Job listings




   Misc

   Amazon

   Links

    


Visual basic example
 

 

 

Visual Basic example

The Visual Basic example is slightly more complex because Visual Basic has no direct equivalent of OUT in QBasic or _outp() in Visual C++ . This means you have to write a DLL or use someone else's . We will choose the latter .

Download inpout32.zip

Unzip the file and follow the instructions in the file called inpout32.txt
Put the inpout32.dll in c:\windows, c:\windows\system and
your program's default directory to insure your program can find it.

Now lets create a simple program to test the simple circuit . First create a new project and place 2 command buttons on this form , call one of the buttons LED on and the other LED off.

figure 1 : Visual Basic layout

Now enter this in the general declarations section

Private Declare Function Inp Lib "inpout32.dll" _
Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Private Declare Sub Out Lib "inpout32.dll" _
Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)

Dim Port1 As Integer

Now enter the following in the LEDS ON command button's click procedure

Private Sub Command1_Click()
Port1 = 888
Out Port1, 1
End Sub

Now enter the following in the LEDS OFF command button's click procedure

Private Sub Command2_Click()
Port1 = 888
Out Port1, 0
End Sub

Now run your program and test out the buttons , viola the led switches on and off .

Download

ledflash.frm
ledflash.vbp
ledflash.exe

 

 

 

 

 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
display a files contents in a text box(VB)
get todays date(VB.net)
Does a directory exist(VBNet)
HORIZONTAL SCROLLING TEXT(Darkbasic)
Shutdown XP(VB)
display the IP address using WMI(VB)
sorting an array(PHP)
vertical scroller(Javascript)

    




Copyright © 2003 by programmershelp.co.uk