Trying to convert old QB program to VB.NET. The declarations block would help a lot. I know full well your not going to convert the whole program for me LOL. I only wish :-).

1 REM FILE: DUALFAZE.BAS, WRITTEN IN QBASIC
2 REM
3 REM Printer port control of 6-wire stepping motor via LPRINT command.
4 REM Two of the four windings are always energized
7 REM
100 D0 = 1
110 D1 = 2
120 D2 = 4
130 D3 = 8
135 T = 300
137 REM
138 REM %%%%%%%%%%%%%%%%%%% -=[ METHOD ONE ]=- %%%%%%%%%%%%%%%%%%%%%%%%%%
140 REM
142 REM Semicolens at end of LPRINT statement tells BASIC to not add
145 REM carrage return and line feed to transmitted data.
147 REM
150 FOR e = 1 TO 10: REM step motor 40 steps in clockwise direction
160 LPRINT CHR$(D0 + D1); : GOSUB 500
170 LPRINT CHR$(D1 + D2); : GOSUB 500
180 LPRINT CHR$(D2 + D3); : GOSUB 500
190 LPRINT CHR$(D3 + D0); : GOSUB 500
200 NEXT e
210 FOR e = 1 TO 10: REM step motor 40 steps in counter-clockwise direction
220 LPRINT CHR$(D3 + D0); : GOSUB 500
230 LPRINT CHR$(D2 + D3); : GOSUB 500
240 LPRINT CHR$(D1 + D2); : GOSUB 500
250 LPRINT CHR$(D0 + D1); : GOSUB 500
260 NEXT e
270 REM

I ran this in old QB years ago on a very old machine.
VB.NET and the VS IDE are very new to me. Even a few hints would help. No, there isn't a collage near by that offers the course. I'd go if I could. The inpout32.dll is working fine.

Thanks for any help.

GaryR

Trying to convert old QB program to VB.NET. The declarations block would help a lot. I know full well your not going to convert the whole program for me LOL. I only wish :-).

1 REM FILE: DUALFAZE.BAS, WRITTEN IN QBASIC
2 REM
3 REM Printer port control of 6-wire stepping motor via LPRINT command.
4 REM Two of the four windings are always energized
7 REM
100 D0 = 1
110 D1 = 2
120 D2 = 4
130 D3 = 8
135 T = 300
137 REM
138 REM %%%%%%%%%%%%%%%%%%% -=[ METHOD ONE ]=- %%%%%%%%%%%%%%%%%%%%%%%%%%
140 REM
142 REM Semicolens at end of LPRINT statement tells BASIC to not add
145 REM carrage return and line feed to transmitted data.
147 REM
150 FOR e = 1 TO 10: REM step motor 40 steps in clockwise direction
160 LPRINT CHR$(D0 + D1); : GOSUB 500
170 LPRINT CHR$(D1 + D2); : GOSUB 500
180 LPRINT CHR$(D2 + D3); : GOSUB 500
190 LPRINT CHR$(D3 + D0); : GOSUB 500
200 NEXT e
210 FOR e = 1 TO 10: REM step motor 40 steps in counter-clockwise direction
220 LPRINT CHR$(D3 + D0); : GOSUB 500
230 LPRINT CHR$(D2 + D3); : GOSUB 500
240 LPRINT CHR$(D1 + D2); : GOSUB 500
250 LPRINT CHR$(D0 + D1); : GOSUB 500
260 NEXT e
270 REM

I ran this in old QB years ago on a very old machine.
VB.NET and the VS IDE are very new to me. Even a few hints would help. No, there isn't a collage near by that offers the course. I'd go if I could. The inpout32.dll is working fine.

Thanks for any help.

GaryR

I guess no answer is better than one that has nothing to do with the question.
Guess I'm on my own with this.

If you asked me about the things I know a great deal about, I probably will give the same answer you've given me.

Hmm. Patience is a virtue. I would help but I don't know VB.NET for anything. What I do know about it though is it's all object oriented. What if you just replace those LPRINTS with printing to some textbox object? I really don't have the slightest clue. Sorry.

The Lprint gets replaced with something like (Out, (port Address)

It's the
100 D0 = 1
110 D1 = 2
120 D2 = 4
130 D3 = 8

that has me going. I not sure where to put it. I think it looks something like (DIM D0=1) or something. It's a little like an alias. I would have put it just below

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


Public _________ Sub

Dim D0=1
Dim D1=2
Dim D2=4
Dim D3=8

End Sub

I think it's something like this , but thoes that know don't seem interested, here or on anyother forum or group.
BTW: thanks for helping with the login prolem :-)

GaryR

I'd help you out if I had/used .NET, but stick with vb6 :(

Give it a shot. .NET has an up date wiz that seems to work for the most part.
Then too, in this isolated case, I don't think there is going to be all that much difference. You may very likely have just the clue I need. At the very least, I'll learn something more about VB in general. Thanks for any help Comatose.

GaryR

Hi,

You can use these to call unmanaged code from a DLL using P/Invoke on VB.Net but you must start with Imports System.Runtime.InteropServices to be able to use DllImport. LPT1: (parallel port) is generally port 378h.

<DllImport("inpout32.dll")> Public Shared Function Inp32(ByVal PortAddress As Short) As Short
End Function
<DllImport("inpout32.dll")> Public Shared Sub Out32(ByVal PortAddress As Short, ByVal Value As Short)
End Sub

As NT based OS's (2000-XP) doesn't allow direct access to hardware you use a kernel driver to overcome this protection thats why configuration of driver, and port assignement for LPT1 on Device manager is important.

Loren Soth

I have gotten this thing working and am now working on making it a menu driven application.

I am more than a little disappointed more people didn't offer some kind of help or hints.

Converting from VB6 is nearly as bad as from Quick Basic. I can well understand the resistance to up grade to VB.NET. If your programing as a hobby there is no harm in staying with Vb6. If you are thinking of programing for aliving, you'd best go with VB.NET and the Visual Studio. It's confusing as hell at first, but that will pass with persistance, a lot of persistance LOL.

There are darn few experts in VB.NET. There are very few good courses in VB.NET.
However, I do think it's worth the pain to learn it. It's far more productive in that a lot of code no longer is needed.
The VB6 to VB.NET conversion wizard in VB.NET is a major help . It porvided the clues in going from QB to VB.NET.

In keeping with the tone of this site, I will not post the solution . I'm tempted but will resist.

I do think this thread should be kept open . It was helpfull to some degree. It might help others.

BTW: Some of the thiongs I know a great deal more about are , radio control, photography, metal casting, machine shop. At least with thoes, I'm not nearly as lost :-).

Old dog, learning new tricks.

GaryR

I need efficient notes on VB.NET, could u help me sending the notes please

Your kidding right? I can't help but wonder how you've gotten this far without knowing how to make/take notes. The few notes I have would be of no help. I'm G/T and my notes are far different, from what you need.

What your asking for is a form of cheating. It's done all the time I know,but it's still cheating. It may help you get a good grade, but it will cripple you on the job. I've lost count of the jobs I've gotten cause some engneer did the very same thing to get a degree.

No, I don't have a degree. No, I never went to collage, not as a student anyway. I have served as educational consultant to a few proffessors though.

Sorry, I don't think I can help you.

GaryR

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.