Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Convert qbasic to visual basic

Posted on 1999-01-16
3
2,848 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

808 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