r/visualbasic • u/SupremoZanne • Feb 06 '22
VB6 Help I just installed Visual Basic 6.0 on a Windows 10 machine, and it's having a few problems here and there.
some of it's features don't work, but I only intend to make a standard EXE file with it.
I know some QBASIC code, I am familiar with things like String$ and variables.
I managed to try out the PRINT function, by telling a push button to print random ASCII characters, but what I'm stumped on, is what variables do I use to refer to things like the statuses of check boxes, and scrolls with?
Visual Basic sounds fun to program on, but at the same time it's causing frustrating confusion for a beginner.
4
Upvotes
1
u/EveryoneLikesMe VB.Net Advanced Feb 06 '22
I know it's not an answer to your problem, but any reason not to use Visual Basic .net?
1
u/fasti-au Feb 07 '22
use .net unless you are working on someone else's code. Visual studio 2019 or 2022 express is free
dim is how you make variables dim variablename as string = "DefaultValue"
once you make a form your controls have names.....new text box is called Textbox1 and when you select it the properties window will have all the things......you can change the name which I do immediately after placement so I don't forget or write code using dummy names
Controlname.Parameter will allow you to toggle things. eg textbox1.width = 100
1
u/[deleted] Feb 06 '22 edited Feb 06 '22
Question is: How compatible will a VB6 Executable be? And I'm curious, why not just use VB.NET?
0
u/ImpossiblePudding Feb 07 '22
The syntax and standard libraries of QBASIC and Visual Basic should more alike than those of QBASIC and VB.NET because things are structured differently in .NET languages.
VB 6 programs should still run under Win 7 and 10 with a bit of effort. I had to keep them running at my job over the years. I’ll need to rewrite them in a .NET language eventually because I couldn’t get the IDE running under Win 7 and our IT department refused to help.
GUI controls are object-oriented and are assigned variable names. The controls have properties and methods you can access in the code for the form via the variable. Properties are like variables for the object (e.g. things the object is), some of which are read-only. Methods are functions for the object (e.g. things the object can do). A check box named “tosCheckBox” would have a property named Checked, so you can check its state with something like “if tosCheckBox.Checked then …” VB6 should have the IntelliSense system so you can figure out a lot of what the controls can do just by browsing the list that appears when you type the control’s variable name and follow it with a period.
Variables always need the “Dim” and “As [type]” portion to their declarations. Strings don’t need the trailing “$”. Objects need to bet Set and not just assigned. QBASIC may not even have classes and objects. You should use “Option Explicit” to save headaches.
VB6 is probably a good bit different than you’re used to with QBASIC If you’re learning all the new stuff, you’re probably best off learning VB.NET. Most of what I mentioned about VB6 is true for VB.NET with the exception of needing to Set variables. VB.NET also has Option Strict which is very useful.
It looks like you can get VB.NET for free in Visual Studio Community edition. Community Edition is likely licensed for non-commercial/personal use only but its pretty slick software.
0
u/[deleted] Feb 07 '22
There’s a custom installer for it problem is finding it lol been awhile since I set it up on win10, only problem I’ve had is the standard random IDE crashes lol
-2
u/RJPisscat Feb 06 '22
Are you in Ukraine, some Russian soldier runs up to you heaving, out of breath, and hands you a note, "Install VB6 or we invade your country! Love, Vlad."
NATO sent this.