Page 1 of 1
Quick Basic to Visual Basic
Posted: Wed May 07, 2003 2:57 am
by Guest
I am working on a project that requires me to translate lots of
QuickBasic code to Visual Basic. Does anyone know a good source for:
- Automated code translator (unlikely)
- Book that compares both languages
- Article that compares both languages
- Table showing QB statements and equivalent Visual basic
The Quick Basic version is 4.0 and Visual Basic is 6.0 SP5
I've never seen one.
Posted: Wed May 07, 2003 12:22 pm
by Guest
I don't believe there is a converter/translator for what you're asking.
I'm uncertain if qb4 can save in TEXT or not. However, I'm certain qb4.5 can. IF you can save as text, most of it will pass into vb6 as module code (when you ADD FILE to the project). You'll have to do some tinkering around but essentially:
PEEKS, POKES, DEF SEGs, Call ABSOLUTES/INTERRUPTS (all low level {aka assembly type} instrustions) are not passed in nor allowed in vb6...You should use VC for that...or access appropriate api calls.
Some (and I mean very little) of the graphics commands are still allowed to be used. However, they have to be placed on a form.
/-----Example:-------/
(create new blank form + cut and paste below into form's code and run...you should see 3 circles)
private sub form_load()
me.show
print "This is the best print you'll never want to see again."
For MyCycle = 50 To 300
Me.Circle (600, 600), MyCycle, RGB(255, 120, 255)
Me.Circle (800, 800), MyCycle, QBColor(14)
Me.Circle (1200, 600), MyCycle, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Next MyCycle
End Sub
/-----END-------/
You can still use LINE and PSETs, but not GET/PUT for GRaphics.
As you can see, PRINT "string" will only print to a visable form...you'll have to rethink your PRINTS. I tend to use a lable or textbox (changing the Caption prop). Depending on need, you can use inputbox or msgbox too.
If you have an OEM ver of Vb6 you should look in the help files for examples or MSDN.
You can also try using Google and look for "Tutorial+VB+QB" for keywords. Like I said, you'll have to do some tinkering around to get it somewhat like it was before. but it's a good learning experience.
Have Fun!
--MiggyD