Thursday, June 12, 2014

How to Convert QBasic to Visual Basic



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

2. 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.'

3. 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.

4. 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 BEEPINPUT 'Enter a number'; ZReplace them with the following lines of Visual Basic code, customizing variable names and prompt messages as necessary:If KeyAscii = 65 ThenBeepEndIfZ = InputBox('Enter a number')Remove any 'SCREEN' declarations and replace the 'WINDOW' command with 'Scale.'

5. 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.

No comments:

Post a Comment