Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 16th, 2004, 03:34 PM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form won't close

Is something wrong with my code? I'm working with Microsoft eMbedded Tools, and when I get to the second form it won't close when I hit the OK button. It should close everything, but it won't unload form2 and it is eating my memory.

Option Explicit
Private Sub Form_OKClick()
'unload everything and close program
Unload (Form1)
Unload (Form2)
Unload (Form3)
Unload (Form4)
App.End
End Sub

Private Sub Command1_Click()
' Save Data to invisible string
Form2.Text7 = "Barcode: " + Form2.Text1 + vbCrLf + "Serial Number: " + Form2.Text2 + vbCrLf + "Model: " + Form2.Text3 + vbCrLf + "date: " + Form2.Text4 + vbCrLf + "Owner: " + Form2.Text5 + vbCrLf + "Comments: " + Form2.Text6
Form2.Text1 = ""
Form2.Text2 = ""
Form2.Text3 = ""
Form2.Text4 = Date
Form2.Text5 = "ETL"
Form2.Text6 = ""
' Pop Up confirmation
MsgBox Form2.Text7, vbOKCancel
End Sub

Private Sub Command2_Click()
'Clear all data in fields
Form2.Text1 = ""
Form2.Text2 = ""
Form2.Text3 = ""
Form2.Text4 = Date
Form2.Text5 = "ETL"
Form2.Text6 = ""
'Close the form, pop up the new one
Form1.Show
Form2.Hide
End Sub

Private Sub Form_Load()
Form2.Text4 = Date
Form2.Text5 = "ETL"
End Sub


  #2 (permalink)  
Old March 17th, 2004, 06:28 AM
Authorized User
 
Join Date: Mar 2004
Location: Leopoldsburg, , Belgium.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to frankv25
Default

I'm not shure but maybe you can try pointing to the form

me.unload(form1)
or
me.hide()


Frank
  #3 (permalink)  
Old March 17th, 2004, 08:28 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: McPherson, Kansas, USA.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Where is this code located at in Form1, Form2, or FormX?

Can you give a sequence of events?

In the OKClick() method you have a command App.End does this end the application? If so are you saying the form is still loaded after the application has been terminated?

When you say it is eating your memory can you explain that better?

What is this "invisible string" you refer to? Are you using a textbox with the visible property set to false? Why do you not use a variable instead of a textbox?

It looks to me like you are referencing Form2 from another/other form(s) and using objects in Form2 when you should be using variables. If you need access to values throughout your application then try using a global variable. Just remember to always set the scope to the lowest level. It is not good practice to just create a bunch of global variables.

As long as you are referencing Form2 it is going to be loaded into memory.

Larry Asher
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Close all MdiChield form from open one form/Button salman .NET Framework 2.0 6 December 10th, 2007 03:21 AM
Close all MdiChield form from open one form salman .NET Framework 1.x 0 November 8th, 2007 12:32 AM
How To Close One Form And Show Another form Israr VS.NET 2002/2003 1 December 7th, 2004 12:30 PM
How Do I Close a Form When I Move to Another Form. flyingfox VB.NET 2002/2003 Basics 3 December 29th, 2003 08:56 AM
Cannot close the Form jkalinina C# 3 October 31st, 2003 05:02 AM



All times are GMT -4. The time now is 03:03 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.