?
Solved

VB .Net Need to Click Stop Button to unload form

Posted on 2003-03-07
25
Medium Priority
?
440 Views
Last Modified: 2008-03-10
I have a main form that has 3 buttons. Each of the button will open a new form in the click event. However, after i open one of the new form and closed it, and then when i close my main form, I have to click the Stop Button on the IDE environment to unload the form. Please help. Do u have a vb .net code to see which form is not unloaded. Thank in advance for u help.
0
Comment
Question by:ysk9818
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 5
  • 4
  • +2
25 Comments
 
LVL 1

Expert Comment

by:sillycorn
ID: 8089877
maybe you can see my code in here: http://morxs.www1.dotnetplayground.com/code/mygrid.z
(change the extension to .zip to open them)

but, try not to execute them as in the project files I didnt include the database file (I using sql server as the db server)
0
 

Author Comment

by:ysk9818
ID: 8089959
sillycorn
i look at the code. u r suggesting me to use dispose method to unload the new form object after it is being shown. Still the program does the same thing...u must click the stop button to unload my project.
0
 
LVL 2

Expert Comment

by:Hummusx
ID: 8089973
Can you post some code showing how you are loading and closing the forms?
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:ysk9818
ID: 8090010
sillycorn
i look at the code. u r suggesting me to use dispose method to unload the new form object after it is being shown. Still the program does the same thing...u must click the stop button to unload my project.
0
 

Author Comment

by:ysk9818
ID: 8090019
Private Sub btnTest1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest1.Click
       
     Dim frmTest1 As New frmTest1()
     frmTest1.ShowDialog()
     frmTest1.Dispose()
     frmTest1 = Nothing
End Sub
0
 
LVL 2

Expert Comment

by:Hummusx
ID: 8090026
What about the code for launching the main form?
0
 

Author Comment

by:ysk9818
ID: 8090073
Hummusx:
I use the main form as a start up in the project.. Do i need to unload the main form as well ? I thought vb will automatice unload the main form when we click on the X.
0
 
LVL 2

Expert Comment

by:Hummusx
ID: 8090119
You shouldn't need to, no.  Are you launching any new threads in your app?  Or making outside calls to anything?  I've never seen this behavior before.
0
 

Author Comment

by:ysk9818
ID: 8090241
Hummusx:
No, it simply call the test1 form from main form. how to i find out which form is still hanging there...I know in VB6 there is a way to find a loaded form and unload it. but i dun know how in vb .net
0
 
LVL 5

Expert Comment

by:Tom Knowlton
ID: 8091345
Is your code generic enough that you could ZIP it and send it to me?

Tom
0
 

Author Comment

by:ysk9818
ID: 8091402
Tom. Ok how to i send it to u
0
 

Author Comment

by:ysk9818
ID: 8091475
You can download the code from there. The sympthon happened when i click test 3 and open test3 form and execute the Form Reset couple of time, Then i closed form3. Then when i closed mainform, it happend. thank

http://www.angelfire.com/tv2/steveyee2/testing.html
0
 
LVL 5

Expert Comment

by:Tom Knowlton
ID: 8091501
tom@thebuyersfund.com
0
 
LVL 5

Expert Comment

by:Tom Knowlton
ID: 8091618
Can you send me a screenshot of what error message or show me what is happening?

I can't get the symptoms to reproduce.

Tom
0
 

Author Comment

by:ysk9818
ID: 8091672
tom,
There is no error msg what so ever. It just sit there until i click the stop button in IDE

this is how i duplicated the problem. I open the testing project in IDE, then run it. I clicked Test3 button and execute the Reset Form Control several time, and close Form3. Then when i closed the main form, the project wont unload into design mode until i press the stop sign.

thank
0
 
LVL 1

Expert Comment

by:manialok
ID: 8101137
Though I tried it several times but wasnt able to reporoduce.

You can try few things first why have You declared ResetForm as Public and passing form as varriable

declare it private and instead of passing var use me thre only

if you want to pass form for some reason then pass it byref

because if you call this function outside the scope of this form then you will be passing this forms' object only then dont pass use me and try

if your machine is too slow then remove override of Finalize also may be it is getting unloaded and taking time.

otherwise your code is fine it should unload forms

or this is not full code are you calling resetform from some oter place that i missed.
0
 

Author Comment

by:ysk9818
ID: 8103134
Tom,
Does the computer speed and amount of memory has to do with the problem because i am runnin on window Nt with SP6a on 128 mg of RAM.
0
 
LVL 5

Expert Comment

by:Tom Knowlton
ID: 8103438
ysk9818:

I don't know...maybe.

I am running on Windows 2000 SP1 (?), P4, 1.7 GHz, 256 MB RAM.

Still, sounds like you have plenty of RAM.  As far as NT vs 2000, I don't know if there is an issue there.
0
 
LVL 1

Expert Comment

by:manialok
ID: 8108984
ysk try things what i told you because i have machine as yours
0
 

Author Comment

by:ysk9818
ID: 8111704
manialok:
What do u mean by the below statemet:

"if your machine is too slow then remove override of Finalize also may be it is getting unloaded and taking time."

Are u suggesting that i am removing the default sub:
Protected Override Sub Finalize()
    Mybase.Finalize()
End sub

does it take more time to unload if i removed the sub. Can u please give me more detail info.. thank alot

0
 
LVL 1

Accepted Solution

by:
manialok earned 300 total points
ID: 8117239
actually you dont need this finalize better leave it to gc I meant that Remove this procedure from your forms.

but i tried many times it always works please provide exact steps if you can
0
 

Author Comment

by:ysk9818
ID: 8120309
Thank to all of your helps. i think this comment solved the problem. i have ran it several time and it seems working. Once again..thank alot..
0
 
LVL 1

Expert Comment

by:manialok
ID: 8125587
but why you graded B if it din solve your problem You should,nt have accepted as answer
0
 

Author Comment

by:ysk9818
ID: 8129587
Manialok:
I did not know that there is a grading system which is A what answer should deserve a B or what so ever.. if the grade is that important to u than helping people and sharing the knowledge among members..then i give u an A.
0
 
LVL 1

Expert Comment

by:manialok
ID: 8134476
Actually ysk i am here to get knowledge and whatever i can give i give and same time expect people to help me when I require. So prime thing is helping each other only.

but it looks bad that you are being graded B for your answer. may be my answer deserved B grade and instead of asking you to grade me A I ll try to do better next time (if that is imp to me means i dont want to be graded as B it looks bad)
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question