Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Convert qbasic to visual basic

Posted on 1999-01-16
3
Medium Priority
?
3,101 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 200 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

782 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