zachtk8702
Feb 10 2005, 03:25 AM
This tutorial applies to all those people who insist upon using "End" to close their programs: End stops the program immediately without any thought as to what's going on - it's like a high speed train hitting a brick wall. It can cause unwanted errors and is bad programming practice in general. END gets rids of the form, but NOT its leftovers. This leaves a bunch of memory that will still be in use even after your program has supposedly closed. An object or variable won't be terminated properly - it's just not a graceful exit. The only time that it's okay to use end is in Form_Load, because there is essentially nothing to unload. Ending the program abruptly also ignores whatever code you have in your Form Terminate, Unload, or UnloadQuery subs. If you don't have leftover objects that you have neglected to nullify (ie - you are a really meticulous coder) and you don't have multiple forms loaded all at once, then "unload me" is the correct thing to do. Otherwise, putting a variation of the following in your Unload sub is the best: Code: Private Sub Form_Unload(Cancel as Integer) On Error Resume Next 'should be at the top of this sub regardless of circumstances ' If you only have 1 form: Dim o As Object For Each o In Me Set o = Nothing Unload o Next ' If you have multiple forms and you want to close the entire app: Dim f As Form For Each f In Forms Set f = Nothing Unload f next ' If you have multiple forms and possible leftovers (this is the best way, just to be safe): Dim o As Object Dim f As Form For Each f In Forms For Each o In f Set o = Nothing Unload o Next Set f = Nothing Unload f Next ' NOW you can put whatever you want, because you safely and methodically cleaned up your program's trail: Unload Me End ' you can even put end if you really really want, because at this point it's safe and there's no garbage left to clean up End Sub
Comment/Reply (w/o sign-up)
FeedBacker
Mar 9 2008, 07:09 PM
How to close 1 form and open another in a button
[tutorial] Visual Basic 6
Can somone Please post a snippet of code on how to close a form and open one in a button. -question by Sanyo
Comment/Reply (w/o sign-up)
FeedBacker
May 20 2008, 06:34 AM
how to show multiple form in visualbasic
[tutorial] Visual Basic 6
How to show multiple form in visual basic -reply by mahaveer
Comment/Reply (w/o sign-up)
iGuest-TheLove
Aug 30 2008, 07:50 AM
how to close a form, and open one in a button
[tutorial] Visual Basic 6
Replying to iGuestHaha aiite m8 prety much Imagine this You got 1 form, say form1 , and you have a command button rite And you got one that you want to open , called form 2 What you want is When say Sub_command_click Form1.Visible = False Form2.Visible = True and yeh.. Thats it HAHAH So prty much, when that BUTTON is click BAM!, form 1 = disappeared Form 2 = INFRONT OF YOU = 0 Haha <3 hope that helps m8 Xx. -reply by TheLove
Comment/Reply (w/o sign-up)
iGuest-TheLove
Aug 30 2008, 07:48 AM
how to close a form, and open one in a button
[tutorial] Visual Basic 6
Replying to iGuestHaha aiite m8 prety much Imagine this You got 1 form, say form1 , and you have a command button rite And you got one that you want to open , called form 2 What you want is When say Sub_command_click Form1.Visible = False Form2.Visible = True and yeh.. Thats it HAHAH So prty much, when that BUTTON is click BAM!, form 1 = disappeared Form 2 = INFRONT OF YOU = 0 Haha <3 hope that helps m8 Xx. -reply by TheLove
Comment/Reply (w/o sign-up)
tinoymalayil
Apr 23 2009, 02:00 AM
VTC Tutorial for VB 6 is good..Please visit website of Virtual training Company to get VTC VB6 Video Tutorial VTC Tutorials are helpful to study programming languages
Comment/Reply (w/o sign-up)
(G)JK
May 15 2009, 05:00 PM
...problem
[tutorial] Visual Basic 6
There is a small problem with the code snippets - the object should be unloaded before being deallocated:
Dim o As Object
For Each o In Me
Unload o
Set o = Nothing
Next
Dim f As Form
For Each f In Forms
Unload f
Set f = Nothing
next
Dim o As Object
Dim f As Form
For Each f In Forms
For Each o In f
Unload o
Set o = Nothing
Next
Unload f
Set f = Nothing
Next
Comment/Reply (w/o sign-up)
cgom
Jun 3 2009, 06:40 PM
I don't mean to be rude... but VB 6 is still being used? It was the last version of VB before .NET was released, and I thought everybody had moved onto that. If that is not the case, I would love to enlightened. Regardless, it is a good language to get started in. The syntax might not make sense at first, but it is a pleasure once you understand it.
Comment/Reply (w/o sign-up)
Gravity17
Jun 5 2009, 05:13 AM
QUOTE (FeedBacker @ Mar 9 2008, 03:09 PM)  How to close 1 form and open another in a button [tutorial] Visual Basic 6
Can somone Please post a snippet of code on how to close a form and open one in a button.
-question by Sanyo QUOTE (FeedBacker @ May 20 2008, 02:34 AM)  how to show multiple form in visualbasic [tutorial] Visual Basic 6
How to show multiple form in visual basic
-reply by mahaveer To close 1 form and open another 1 is simply CODE me.hide show.form2 and to open multiple what do you mean like on startup or open them 1 by one?
Comment/Reply (w/o sign-up)
Similar Topics
Keywords : visual, basic, 6, closing, programs, end, bad
- Ftp In Visual Basic 6.0
Start making your FTP client using VB6 (3)
Start Multiple Programs With One Shortcut
Windows XP (25) Welcome to my turoial on how to start multiple programs using one shortcut. You may probably be
wondering how this is possible. Well this tutorial will use a language from MS-DOS called batch. I
am not sure whether it is "language", but I do know that it is a way to program for MS-DOS. Batch is
simply a way to run several MS-DOS commands with just one command. All batch files are run through
Command Prompt, but they can be accessed with shortcuts also. Here are a few requirements for this
tutorial. Requirements Windows XP (I tested this on XP, but it should work on m....
Reducing Windows Vista Start Menu Programs Response Time.
How to do it. (4) If you have been using Microsoft Windows Vista for quite some time, you would have noticed that
installing a number of programs/softwares into your computer considerably slows down the response
time of your start menu program folder, sometimes up to one second or more before the programs
listed in a particular start menu folder is displayed. Worst of all, if you are trying to launch a
program from you start menu which is within another start menu prrograms folder. Well, I have found
a way to bypass this very annoying thing in Windows Vista. I have about 98 start menu en....
Giving Important Programs Priority
Alloacating more resorces with Windows XP (2) If you want to allocate more resources to an important program you are running do the following: 1)
press ctrl+alt+delete 2) select the "processes" tab 3) find the program you are using and
right-click on it 4) on the drop down bar that appears scroll over "select priority" 5) select
"high" (CAUTION DO NOT SELECT "REALTIME" AS THIS MAY IMBALANCE YOUR SYSTEM) 6) A warning will
appear, click yes If you follow these easy steps you will find that whatever program you have done
this to should run faster and more efficiently. However, this is something that must be done each....
Creating A Timer Program
Using Visual Basic 2005 (8) This tutorial will explain how to create a basic timer using Visual Basic Express 2005. If you
don't have it, it's free and you can dowload it from Microsoft's website. All you need
is a few minutes to sit down and read this and a version of Visual Basic. OK, so what will this
timer actually do? Well, you are able to enter a number of minutes and a message, and then click a
button. Once the timer is up, your message pops up and you are reminded! So, basically it's a
little reminder system. I use it to remind me when TV programmes start, when I have to go ....
Creating A Simple Image Viewer
Using Visual Basic 2005 Express Edition (4) I downloaded Microsoft's Visual Studio Express suite a few months ago, but only recently got
around to installing it. I have been practising with Visual Basic and making some rather basic
programs and utilities, but they contain most of the basic concepts. This tutorial will explain how
to create a basic image viewer, and I will try to explain each step from beginning to end as clear
as I can. To start you will need: Microsoft Visual Studio About 10-20 minutes free time OK,
first open up the Visual Basic part of the Studio. I am using the 2005 Express version, so....
How To Make A Web Browser
Visual Basic 6 (83) This is a simple and specific tutorial on how to make a basic web browser in Visual Basic 6. Steps
1-3 Create a new project, and then go to "Project" on the menu. Click components as shown in the
following image. Find the component "Microsoft Internet Controls," check it, and click "Apply" and
then "Close." Click the icon that was just added in the tools window, and draw a large sized
window with it. This is going to be where you view webpages through your browser, so don't make
it small, but leave room for buttons and other accessories. Steps 4-6 Make a t....
Bit Shifting In Vb
Shifting bits in Visual Basic (0) This is for all Visual Basic programmers out there, who want to programm some form of encryption
algorithm, or anything else that includes shifting bits left or right, for that matter. Most of you
who have tried to accomplish this, know that Visual Basic doesn't have any function for bit
shifting. And bit shifting si very usefull /smile.gif' border='0' style='vertical-align:middle'
alt='smile.gif' /> Some of you probably know how to shift bits, but this tutorial is for those who
don't know how to do it... Shifting bits is actualy easy, we use multiplication ....
Simple Login In Visual Basic 6
user interaction example trough login programm (9) First of all, I am NOT a programmer, this is something my friend taught me. It describes basic
interaction with the user, while showing basic functionality of this simple programm. So, without
further ado, we're off to the tutorial: First of all, start your visual basic, when prompted
for new project, select Standard Exe . Next, we need to open code window, so we can start typing
the program. This can be done in two ways, one is double clicking on the form, or selecting Code
from View menu. If you double clicked on the form, you will see following text: CODE ....
How To Remove Programs Safely
Newbie Tutorial (3) How to properly remove programs from your computer: Windows 98 has added a little program that
helps you delete applications safely and CORRECTLY. Why correctly? Because a lot of new software
leaves entries in the Registry, and unless you uninstall your programs, the excess code gets left
behind. Not so tidy. So when you want to uninstall an application, follow these steps: 1. Click
Start. 2. Choose Settings then Control Panel. 3. In the Control Panel window, double-click the
Add/Remove Programs icon. 4. Under "The following software can be automatically removed by Wi....
Simple Visual Basic 6 Tutorial
Tutorial 1: Msgbox (0) For this tutorial you will learn how to make a very simple, and basic program. Step one- Create a
new form. Step two- Click the command button on the side and make two buttons. Step Three- Click
on on of the command buttons you drew, and on the side there will be a menu. Change the caption to
Button 1, and repeat the same with the other button, but the caption Button 2. Step four- Double
click one of the buttons, and put in CODE Dim button button = MsgBox("What you want to say
here", 65, "Title") Now change that code to what you want it to say; i.e. title could....
[tutorial] Visual Basic 6
Adding Commas to Large Numbers (0) This isn't a very long tutorial. I get asked this often, so here is the solution. The following
code will return a string containing a number that has commas appropriately placed: Code:
myStringOrProperty = FormatNumber(3587532789053, 0) The second parameter (0) represents how many
decimal places you want the returned number to go out to. Unless your number contains its own
decimal, you probably don't want .00 at the end of every number you have. The above code would
return: 3,587,532,789,053 This should make life easier for many.......
Security Programs And Links
(2) I written this security advice for many support services/Forums so i decided to post a copy for
Trap17 too.Well Choosing security software what's in that?Just install antivirus/firewall,keep
it updated and Relax.No this will not help you at all.So in this Tutorial what i am going to cover
is Security software (Antivirus & Firewalls Encryption software, Few utilities).At last i will
also tell you what to do to avoid virus infecting from your PC. First Lets start with encryption
software why we need it?Encryption software converts your data into secret code & to co....
Looking for visual, basic, 6, closing, programs, end, bad
|
Searching Video's for visual, basic, 6, closing, programs, end, bad
See Also,
|
advertisement
|
|