# Visual Basic > Visual Basic 6 and Earlier >  Index to FAQ's: Classic VB (VB6 and earlier)

## si_the_geek

*Classic Visual Basic (VB 6 and earlier) FAQs*

The following is a list of frequently asked questions for VB6 and VB5, etc.


If you click on one of the questions below, you will be taken to a page that contains at least one possible solution to the problem, and an explanation that you can hopefully understand.   If you think something within the FAQ section needs a better explanation, please let me or the thread poster know via our PM (private messaging) system.

*Please note:* "Classic VB" is the name commonly used for Visual Basic 6/Visual Basic 5/etc, which is what these FAQs are designed for.  If you are looking for help with the 2002 or later (including "*Express*") versions of VB, please see the relevant forum here.


*Sections in this Page**General*
*Coding standards/Good Practice*
*Language syntax*
*Data types/Variables* (including working with Strings, Dates, and Arrays) 
*Controls* (TextBoxes/ListBoxes/etc)
*Forms*
*Closing your forms/program*
*Dealing with Errors*
*Files*
*Registry*
*Printing*
*Multimedia* (music/pictures/etc)
*Working with Other Programs* (includes DOS commands)
*Optimising* (making your program faster/more efficient)
*API* (=Application Programming Interface, basically functions built in to Windows)
*Miscellaneous*

*Other FAQ pages that include Classic VB:*Database Development FAQ
Office Development FAQ (Excel/Word/Outlook/...)
Games and Graphics FAQ
Networking FAQ (Winsock etc)
Application Deployment FAQ (installation packages, etc)


____________________________________________________________
*Recent Additions*
Oct 2017 : [General] Installing the VB6 IDE on Windows 10 - 64 bitOct 2017 : [Miscellaneous] Tutorial: Using OCX Files with SxS TechnologyDec 2015 : [Forms] How can I deal with DPI issues?  (eg: Windows 10 automatically resizing forms)Oct 2010 : [General] Squeezing the most out of Randomize and RndApr 2010 : [General] Where can I get VB6?  Is starting to learn VB6 a good idea?____________________________________________________________

*General*
Where can I get VB6? Is starting to learn VB6 a good idea?
Where can I find the help files (aka MSDN library) for VB 6? 
Installing the VB6 IDE on Windows 10 - 64 bit 
How can I use Random numbers? [Tutorial]for ways to get a bigger range for Randomize, and an alternative to Rnd, see: Squeezing the most out of Randomize and Rnd
What are Events and how do I use them?
How can I tell why my code isn't doing what I expected?
This is done by a process known as Debugging. See Using VB6 debug [Tutorial] for details and explanations.
How can I allow only one instance of my application to run at a time?
How do I Pause my program?
How can I tell which folder my program is running from?
How can I use the mouse-wheel in VB? 
(to scroll the code window, or to make use of the mouse-wheel in your programs)
Why doesn't my program work on another computer?
What do I need to do to make sure my program works in Windows Vista?
How can I change the screen resolution (so my form looks good)?
See "_How can I make my form look the same at different sizes?_" below (in the _Forms_ section).
How can I use command line parameters in my program?
How can I get the source code of a compiled VB file (.exe/.dll/..)?
Can I use VB6 to make a program for mobile phones/PDA's?up to Section list
*Coding standards/Good Practice*
What is indenting, and why should I do it?
Why should I comment my code? How to make my code readable?
What is Option Explicit, and why should I use it?
Why shouldn't I use "Dim .. As New .."?
Also see the article Why is using the 'End' statement (or VB's "stop" button) a bad idea? (from the _Closing your forms/program_ section).
Also see the article Where should I store the files that my program uses/creates? (from the _Files_ section).
Also see the _Dealing with Errors_ section, particularly "_My program works, so does Error Handling really matter?_" and "_What is wrong with using "On Error Resume Next"?_"up to Section list
*Language Syntax*
How do I put the " character into a string?
What do #, $, !, &, @, % mean after a variable name (or number)?up to Section list
*Data types/Variables*
What is a String? _(includes explanations of useful string functions, such as Split and Join)_
What's wrong with _Dim x, y, z As Long_ ?
What is the difference between Dim/Private/Public/Global/Static/Const?
_(or "where can I use a variable I declared?")_
Why are my dates not working properly? _(or 'How should I work with dates?')_
What is datatype coercion?
Why are my dates/numbers giving me the wrong values?
See "_How do I handle different locales?_" below (in the _Miscellaneous_ section).
What is an Enum, and how can I use it? 
(or: "_How can I create a variable/parameter which has a list of possible values that I specify?_")
What are arrays and how do I use them?
How do I check if array has been initialized?
What methods are there to sort an Array? (CodeBank thread)up to Section list
*Controls*
How do I use multiple colours/fonts in a single textbox? (or _"How do I use a RichTextBox?"_)
How can I change the Color of a command button, or show a picture on it?
How can I have a Timer interval of more than a minute?
How can I make new controls at run-time? [Tutorial] (3 methods, including control arrays)How do I detect if an index exists in a control array?
How can I use a progress bar?
How can I pass a control (textbox/listbox/..) to a sub or function?
What controls can I use to input a date/time?
How can I make my controls show in Windows XP styles?
See "_How can I make my form use Windows XP Styles?_" in the _Forms_ section
How can I move/resize my controls to suit the current size of the form?
See "_How can I make my form look the same at different sizes?_" in the _Forms_ section
Other articles on Controls (such as adding a horizontal ScrollBar to a ListBox) can be found in the _API_ section and the _Forms_ sectionup to Section list
*Forms*
How can I make my form look the same at different sizes? (see also the DPI article below)
How can I deal with DPI issues? (such as Windows 10 automatically resizing forms)
See Tutorial: Being DPI Aware from our Tutorials forum
How do i keep a form on top of others?
How can I Hide/Unhide the form's "X" button
How can I make my form use Windows XP Styles? (using a Manifest file)
Other articles on Forms can be found in the _Closing your forms/program_ and _API_ sectionsup to Section list

----------


## si_the_geek

*Closing your forms/program*
How should I close my form/program/class?
Why is using the 'End' statement (or VB's "stop" button) a bad idea?
How can I show a confirmation message when my form is closing?
How can I tell why my form is closing?
Also see the article "_How can I detect/fix memory leaks?_ in the _Miscellaneous_ sectionup to Section list
*Dealing with Errors*
What does this error mean, and how do I fix it?
My program works, so does Error Handling really matter?
Why do errors crash my program, and how can I stop that from happening? (making an Error Handler)
What is wrong with using "On Error Resume Next"?
Why does my program give me errors running as an Exe but not in the IDE?up to Section list
*Files*
How can I check if a file exists?
How can I read/write a text file?How to do basic manipulation of text files [Tutorial]
How can I edit a text file without opening it?
How can I show an "Open" or "Save" dialog?
See this tutorial (which focuses on the dialog), or this tutorial (which also opens/saves files using code similar to the articles above).
How can I read/write an .Ini file?
Where should I store the files that my program uses/creates?
How can I delete a file?
Other articles on files (such as opening a file in its default application) can be found in the _Working with Other Programs_ sectionup to Section list
*Registry*
How can I work with the Registry?
See Working with Windows Registry using Visual Basic 6 from our Tutorials forumup to Section list
*Printing*
How can I Print from my program?
See this tutorial _(ignore/remove any_ ÿ_ characters from the code examples!)_
How can I print less than a whole page?
See this article from MSDNup to Section list
*Multimedia*
How can I play MP3/WAV songs?
For other work with audio, see the Sound and DirectXSound Tutorial 
_(note that it is not finished, but contains lots of info!)._
What picture types does VB support? (or: why wont VB load this picture/icon?)
How can I create/find icons to use in my program?
_For other graphics based issues, see the Games & Graphics FAQ_up to Section list
*Working with Other Programs*
How do I open a file/web-page in its default application?
How do I run DOS commands from VB?
_(note that most DOS commands have VB equivalents, eg: in DOS you have Copy and in VB you have FileCopy)_
How do I shell a command line program and capture the output?
How can I use Excel from VB? [Tutorial]
_(see the Office Development FAQ for other topics relating to MS Office)_up to Section list
*Optimising*
How do I optimize my code?
How do I use one dimensional arrays instead of multidimensional?
I want to use IIf but it is slow!up to Section list
*API*
How do I get the current Windows user name?
What is a window handle (hWnd) and what is it used for?
How can I find a window (hWnd) outside of my program?
How can I retrieve a list of running processes?
Examples of more API functions can be found on a separate FAQ page (*Warning:* _this page takes a while to load!_)
The following links open just the relevant post from that thread:


How to get a windows hWnd from caption/class nameForms/Windows:
Set Window Parent (put one form inside another)Creating odd shaped forms/controlsHow to limit a form's size (min and max)Transparent FormMove Form With No BorderSystem Tray and Title Bar ButtonControls:
A few simple TextBox functions - Line count etcFind an list item in a ListBox by its string value without looping
(ComboBox version)Add Horizontal Scroll bar to ListboxesHow to Select/Deselect All the items in a FileListBox/ListBox/ComboBox.How to Limit the Character Length of a Combo box.mouseover effect on command buttonsSimulate MouseEnter and MouseLeave eventsInformation:
Get Windows versionGet computer nameGet the Windows, System, and Temp directoriesDetect whether a program/ActiveX control/ActiveX DLL is running in the VB6 IDE
Other:
Extracting a file's iconGDI (graphics) functions (the declarations)Arrange Desktop IconsDetermine if a COM Port is Availableup to Section list
*Miscellaneous*
Does Visual Basic 6 support Unicode?
How can I use Unicode with forms and standard controls?
How can I detect/fix memory leaks?
How do I handle different locales?
How do I use Resource Files? [Tutorial]
How can I set my exe icon using a resource file?
How can I deploy an OCX without using an installation package?
See Tutorial: Using OCX Files with SxS (Side-by-Side) Technology
How do I make properties? (for a  Class / Form / UserControl)
How can I show the 'link select' (hyperlink) mouse cursor?
Why is TRUE equal to -1 and not 1?
How do the ReadProperties and WriteProperties work? (PropertyBags)
Why can't I use WithEvents on arrays of objects?up to Section list

If you can think of a "frequent" question (and preferably an answer to it as well) that you think should be added to the FAQs, please see this thread.

----------

