I have some small programs I coded in gwBasic that I want to code in vb6. I don't know exactly where to start. It's not numbered lines in vb6 I attached the code from a gwbasic program
What is attached isn't a Basic source program that can be examined - but a 'binary' version which can't be displayed as Basic source code outside of GWBasic. To get the program as ascii text, open the program in GWbasic and save with the ,a option.
This is the source for the attached program:
Code:
10 DIM NH$(20),VEL1(20),VEL2(20),VEL3(20),MED(20),BL1(20),BL2(20),D$(20),F1(20),F2(20),F3(20)
20 CLS
30 LOCATE 15,28: PRINT "LOAD FILE FROM DISK ? (N)"
40 L$=INKEY$:IF L$="" THEN 40
50 IF L$ = "Y" THEN CLS: FILES "*.TXT": GOTO 70
60 GOTO 90
70 LOCATE 17,28: INPUT "NAME OF FILE TO LOAD ";RACE$
80 GOTO 1300
90 CLS
100 LOCATE 10,30:INPUT "RACE ======> ",RACE$
110 LOCATE 12,30:INPUT "COMMENTS ==> ",C$
120 LOCATE 14,30:INPUT "DIST ======> ",DIST$
130 CLS
140 IF N=0 THEN N=1
150 LOCATE 8,24:PRINT "NAME #";N;
160 INPUT " ",NH$
170 IF NH$ = "" THEN 660
180 NH$(N) = NH$
190 LOCATE 10,24:INPUT "DIST OF PACELINE ",D$
200 D$(N)=D$
210 LOCATE 12,24:INPUT "TIME 1ST CALL ",T1$
220 T1 = VAL(T1$)
230 F=T1-INT(T1)
240 T1=(F*2)+INT(T1)
250 IF T1 >= 100 THEN T1 = T1 - 40
260 LOCATE 13,24:INPUT "TIME 2ND CALL ",T2$
270 T2 = VAL(T2$)
280 F=T2-INT(T2)
290 T2=(F*2)+INT(T2)
300 IF T2 >= 100 THEN T2 =T2-40
310 LOCATE 14,24:INPUT "FINAL TIME ",T3$
320 T3=VAL(T3$)
330 F=T3-INT(T3)
340 T3=((F*2)+INT(T3))-40
350 IF T3 > 160 THEN T3=T3-40
360 IF T3<60 THEN T3=T3+40
370 LOCATE 16,24:INPUT "BEATEN LENGTHS 1ST CALL ",B1$
380 B1 = VAL(B1$)
390 LOCATE 17,24:INPUT "BEATEN LENGTHS 2ND CALL ",B2$
400 B2 = VAL(B2$)
410 LOCATE 18,24:INPUT "BEATEN LENGTHS FINISH ",B3$
420 B3 =VAL(B3$)
430 LOCATE 22,27:INPUT "DATA O.K. ";OK$
440 IF OK$ = "N" THEN CLS: GOTO 150
450 D=VAL(D$)
460 IF D=1.4 THEN D=8.181
470 IF D = 1.7 THEN D = 8.318
480 IF D>=8 THEN D1=4:D2=6:BF=9
490 IF D<8 THEN D1=2:D2=4
500 IF D>=10 THEN D1=4:D2=6:BF=11
510 IF D>=9 THEN BF=10
520 IF D<=7.5 THEN BF=8
530 IF D<6 THEN BF=7
540 D3=D
550 VEL1(N)=((D1*660)-(BF*B1))/T1
560 VEL2(N)=(((D2-D1)*660)-((B2-B1)*BF))/(T2-T1)
570 VEL3(N)=(((D3-D2)*660)-((B3-B2)*BF))/(T3-T2)
580 MED(N)= ((VEL1(N)+VEL2(N))/(VEL1(N)+VEL2(N)+VEL3(N)))*100
590 F1(N)=(D1*660)/VEL1(N)
600 F2(N)=((D2-D1)*660)/VEL2(N)
610 F3(N)=F1(N)+F2(N)
620 BL1(N)=B1
630 BL2(N)=B2
640 N=N+1
650 CLS: GOTO 150
660 N=N-1
670 CLS
680 PRINT" E N E R G Y "
690 PRINT" * * * * * * "
700 PRINT
710 PRINT SPC(10)"Race: ";RACE$;" Dist: ";DIST$; " Furlongs";" Comments: ";C$
720 PRINT" ============================================================="
730 PRINT SPC(12)" Name F1 F2 2C Med% B1 B2"
740 PRINT " -------------------------------------------------------------"
750 FOR I = 1 TO N
760 PRINT SPC(12) USING"## ";I;
770 PRINT USING"\ \";LEFT$(NH$(I),12);
780 PRINT USING" ###.## ";F1(I);F2(I);F3(I);
790 PRINT USING" ###.## ";MED(I);
800 PRINT USING" ## ";BL1(I);BL2(I)
810 NEXT
820 LOCATE 24,22:PRINT "(D)elete (A)dd (P)rint (N)ext ";
830 Y$=INKEY$:IF Y$="" THEN 830
840 IF Y$ = "D" THEN GOTO 1120
850 IF Y$ = "A" THEN CLS: GOTO 640
860 IF Y$ = "P" THEN CLS: GOTO 980
870 CLS:LOCATE 6
880 CLS: LOCATE 15
890 PRINT " Save Race to Disk (Y/N)"
900 Q$=INKEY$:IF Q$="" THEN 900
910 IF Q$ = "Y" THEN 1230
920 CLS: LOCATE 15
930 PRINT " (N)ew Race (R)eview (Q)uit "
940 O$=INKEY$:IF O$="" THEN 940
950 IF O$ = "N" THEN N=0: GOTO 20
960 IF O$ = "R" THEN 670
970 CLS:CLOSE:SYSTEM
980 LPRINT:LPRINT
990 LPRINT SPC(20)" E N E R G Y"
1000 LPRINT SPC(20)" * * * * * * "
1010 LPRINT
1020 LPRINT SPC(5)"Race: ";RACE$;" Dist: ";DIST$;" Furlongs";" Comments: ";C$
1030 LPRINT SPC(4)"======================================================================="
1040 LPRINT SPC(10)"Name F1 F2 F3 Total Med%"
1050 LPRINT SPC(4)"-----------------------------------------------------------------------"
1060 FOR I = 1 TO N
1070 LPRINT SPC(4)USING"\ \";LEFT$(NH$(I),10);
1080 LPRINT USING" ###.# ";F1(I);F2(I);F3(I);TOT(I);
1090 LPRINT USING" ##.## ";MED(I)
1100 NEXT
1110 GOTO 880
1120 LOCATE 25,15
1130 INPUT " Scratch # ",S
1140 IF S=N THEN 1220
1150 FOR I = S TO N
1160 NH$(I)=NH$(I+1)
1170 F1(I)=F1(I+1)
1180 F2(I)=F2(I+1)
1190 F3(I)=F3(I+1)
1200 MED(I)=MED(I+1)
1210 NEXT I
1220 N=N-1: GOTO 670
1230 REM SAVE FILE TO DISK
1240 OPEN "O",#1,RACE$ + ".TXT"
1250 FOR I = 1 TO N
1260 WRITE #1,NH$(I),VEL1(I),VEL2(I),VEL3(I),MED(I),DIST$,D$(I),BL1(I),BL2(I),F1(I),F2(I),F3(I)
1270 NEXT
1280 CLOSE #1
1290 GOTO 920
1300 OPEN "I",#1,RACE$ + ".TXT"
1310 I=1
1320 IF EOF(1) THEN 1350
1330 INPUT #1,NH$(I),VEL1(I),VEL2(I),VEL3(I),MED(I),DIST$,D$(I),BL1(I),BL2(I),F1(I),F2(I),F3(I)
1340 I=I+1: GOTO 1320
1350 CLOSE #1
1360 I=I-1
1370 N=I
1380 GOTO 670
Last edited by 2kaud; Apr 11th, 2025 at 04:03 AM.
All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/
I suppose you start by defining the form layout, buttons, input boxes &c then attach the relevant bit of BASIC logic to each using your .BAS listing as a guide.
It is going to be a manual task as VB6 has it's own built-in graphics framework and is event driven whereas GWBASIC is largely linear in operation and has no graphic framework, so the program logic will need to be converted from the linear GWBASIC type to VB6's event driven model.
You just have to dive into it and start converting.
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
Something like this won't be simple 1->1 conversion of code for a host of reasons. GWBasic is sequential code, VB is event driven.
Essentially, it would be taking the principles of what the original code is doing and writing new VB6 code. All of the code that displays output would need to be rewritten. All of the code that gets user input would need to be rewritten. At a quick glance, I would say that the bulk of the math code could be reused in its entirety. All of the line number jumps would need to be understood to determine how they should be handled.
If you don't have a great handle on those things you will struggle.
Not sure where to start? Well, you could start by writing a description of your program's purpose and how it is intended to be used.
Also, if you're going to update it, why move to vb6? Why not Python? It's a modern language suited for console-based applications such as your program - on many different platforms.
Is that python code? This gwbasic code is how I learned to code. I made that program in the 90's and it takes information you enter about a horse race and outputs a report. I only moved on to visual basic after that and I'm not experienced in coding at all