Solved

Convert qbasic to visual basic

Posted on 1999-01-16
3
2,748 Views
Last Modified: 2013-11-25
Is there a book or other kind of publication that describes how to convert qbasic to visual basic?
0
Comment
Question by:7for7est
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 50 total points
ID: 1469000
Not that I'm aware of, but I've done the conversion and it is easy. 98% of your code will port without modification. Problem areas are:

1) QBASIC allows "." as part of variable name, VB uses this as a field separator. Change all "."'s in variables into some other character, "_" works well.

2) VB does not support the DATA/READ statements - dunno why - You'll have to use a series of explicit assigns instead.

3) VB likes to start things with a form, but you can start in a module (.BAS file) instead. Create a new project with a blank form. Change the project properties to start in SUB MAIN(). Drop the form and you'll have a "form less" VB app. Place SUB MAIN() in the start of your QBASIC source file (just past the variable declarations block, before the first executable statement. Place an END SUB at the bottom.

4) INPUT statements are passe. You should create a form with text boxes and a command button. Where you would perform input just hang out and wait for the command button to be pressed. If you need input validation use the Microsoft Masked Edit control instead of straight text box.

Biggest difference is that VB executes in non-linear fashion. VB is event driven. You won't need polling loops in your code waiting around for operator input (no more INKEY loops!). When the system is waiting on operator input *NONE* of your code should be executing! This is a different mindset, but once you get the hang of it, it is actually easier. Don't fight it, if you're trying to do something that worked in QBASIC and it seems *impossible* in VB take that as a sign that you're comming at it from the wrong direction. VB is actually easier to code in but you DO have to change your way of thinking. You've got to break out of the linear execution mold or you'll be ripping your hair out.

Write me direct if you want to chat.

    Mark_Lambert@ntsc.navy.mil

M

0
 

Author Comment

by:7for7est
ID: 1469001
Thanks much Mark2150! I first began to use basic when we got a Tandy model 100 portable computer. We have used qbasic on our 486 ever since for business purposes. Then we upgraded to Windows 98, and found that our numerous programs would not run. So we are now somewhere near the bottom of a new learning curve. We've taken it as a challenge and much appreciate your concise answer.
0
 
LVL 12

Expert Comment

by:mark2150
ID: 1469002
Glad to help. I've got a *TON* of code that I wrote in QBASIC-IV (compiled). I *STILL* use it as it generates "rock hard" standalone .EXE files that *NEVER* crash (as long as *MY CODE* is clean!) I use it for batch file based stuff and there's nothing better!

VB is great for quickly generating GUI stuff. I love the fact that it talks to Access database natively - I'll *NEVER* code another FIELD statement! (grin).

Like I said, 98% of my QB-IV code ported to VB with little tinkering. I found that in many cases it was easier to recode as VB and just lift the occassional subroutine from the QB-IV code. This allows me to rapidly build up a pretty GUI and still draw on the library of debugged subs in my QB-IV archives.

M

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now