How to Convert QBasic to Visual Basic

The simple QBasic programming language was shipped with every DOS computer in the 1980s and early '90s. Microsoft's Visual Basic language has since replaced it, allowing hobbyists to write programs that use the Windows interface instead of the command line. The two languages are largely compatible, however, allowing you to easily convert your QBasic code to the more current language.

Video of the Day

Programming languages have evolved from punchcards.


Rename the file extension of your QBasic program from ".bas" to ".txt" and ignore any warning messages.


Open Visual Basic and double-click "Button" in the toolbox to add it to your form. Change the button's text property in the right panel to "Start."


Double-click the button to open its code page. Select "Edit" > "Insert File" and choose your QBasic code text file. This will make your QBasic code run when the user clicks the Start button.


Modify the QBasic code to conform to Visual Basic standards. Note the presence of any lines that look like the following:

IF INKEY$ = A THEN BEEP INPUT "Enter a number"; Z

Replace them with the following lines of Visual Basic code, customizing variable names and prompt messages as necessary:

If KeyAscii = 65 Then Beep EndIf Z = InputBox("Enter a number")

Remove any "SCREEN" declarations and replace the "WINDOW" command with "Scale."


Click the green arrow on the toolbar to run the program. If everything works properly, click the "Start" button to execute. If you receive an unrecognized command error, consult the Visual Basic documentation to find the proper replacement to use in place of the outdated QBasic command.

Show Comments