473,382 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Question on Working With Forms

This should be an easy questions, but I have not had any luck with the answer.

Can you load all forms in a project at once and just have the visible =
False for all but one??? Then to switch between forms, all you would have to
do is work with the visibility property.

I have a project that has forms and I will need to switch between all of
them. One is the main form and it stays loaded (And visible), but the others
will load depending on the operator input. Also, I will have other forms
start even more forms. For example, I will have the main form (Form1) start
form2. Then form2 will start form3. When form3 closes, I need to close form2
& form3. It would be easy if I could just change the visiblity of form2 &
form3.

Maybe I am going about this wrong. Is there a better way?

PLEASE HELP.
Jul 22 '05 #1
7 1198
Using VB.Net 2003
"Stingray5678" wrote:
This should be an easy questions, but I have not had any luck with the answer.

Can you load all forms in a project at once and just have the visible =
False for all but one??? Then to switch between forms, all you would have to
do is work with the visibility property.

I have a project that has forms and I will need to switch between all of
them. One is the main form and it stays loaded (And visible), but the others
will load depending on the operator input. Also, I will have other forms
start even more forms. For example, I will have the main form (Form1) start
form2. Then form2 will start form3. When form3 closes, I need to close form2
& form3. It would be easy if I could just change the visiblity of form2 &
form3.

Maybe I am going about this wrong. Is there a better way?

PLEASE HELP.

Jul 22 '05 #2
Stingray,

When you start one form as the owner, than you can hanlde them all handle
them all.

(You can start from form2 a form3, however I would instance them all from
the owner).

Cor
Jul 22 '05 #3
Ok, I think that is what I am doing.

Say, from from1,
Code on button1

dim form2 as new form2
dim form3 as new form3
form2.showdialog()
form3.showdialog()

On form2, when it closes, I run
dispose()

Then this will auto start form3
When form3 closes, I run
dispose()

This takes me back to form1. Just how I want it. This process will happen
multipule times. From from1-> Form2 -> form3 back to form1. But watching the
memory in
task manager on this process, the memory keeps going up each time.

Is dispose() the correct way to remove each form?
"Cor Ligthert" wrote:
Stingray,

When you start one form as the owner, than you can hanlde them all handle
them all.

(You can start from form2 a form3, however I would instance them all from
the owner).

Cor

Jul 22 '05 #4
> Ok, I think that is what I am doing.

Say, from from1,
Code on button1
dim frm2 as new form2
frm2.showdialog()
frm2.dispose
dim frm3 as new form3
frm3.showdialog()
frm3.dispose

This is a normal for modal forms, you was confusing me. If you want to hide
form1 in the maintime you can even do me.visible = fals and me.visible =
true (me is the instanced object from the class)
This takes me back to form1. Just how I want it. This process will happen
multipule times. From from1-> Form2 -> form3 back to form1. But watching
the
memory in
task manager on this process, the memory keeps going up each time.

Is dispose() the correct way to remove each form?

Dispose does not remove memory. The memory is removed by the Garbage
Collector. That runs at the moment that it is efficient to run. Watching the
taskmanager gives by the way only a kind of avarage result.

The modal form is one of the exceptions where it is *useful* to use the
dispose.

I hope this helps,

Cor
Jul 22 '05 #5
Well, I am still getting the same results.

Running the code below:
dim frm2 as new form2
frm2.showdialog()
frm2.dispose
dim frm3 as new form3
frm3.showdialog()
frm3.dispose
CG.Collect()

If you keep clicking the buttons.... Load Form2, close, load form3 close &
Repeat
the memory in the task manager keeps going up. Even if it's not that
accurate, it still goes up.

If you let it sit there a little while, you can see the GC kick in and lower
the memory usage some but never all the way.

Going from form to form like shown will happen approx 10,000 times before
the app is closed. I am worried about the memory getting out of hand.

Is there a better way to accomplish this same task?

Main Form -> Input Form1 -> Input Form2 (Close Form1 & Form2)
"Cor Ligthert" wrote:
Ok, I think that is what I am doing.

Say, from from1,
Code on button1

dim frm2 as new form2
frm2.showdialog()
frm2.dispose
dim frm3 as new form3
frm3.showdialog()
frm3.dispose

This is a normal for modal forms, you was confusing me. If you want to hide
form1 in the maintime you can even do me.visible = fals and me.visible =
true (me is the instanced object from the class)
This takes me back to form1. Just how I want it. This process will happen
multipule times. From from1-> Form2 -> form3 back to form1. But watching
the
memory in
task manager on this process, the memory keeps going up each time.

Is dispose() the correct way to remove each form?

Dispose does not remove memory. The memory is removed by the Garbage
Collector. That runs at the moment that it is efficient to run. Watching the
taskmanager gives by the way only a kind of avarage result.

The modal form is one of the exceptions where it is *useful* to use the
dispose.

I hope this helps,

Cor

Jul 22 '05 #6
Stingray,

As I said the taskmanager is not giving the correct figurs

Calling GC cost you performance. I assume you know that.

Have a look at a message from Willy in this newsgroup.

http://groups-beta.google.com/group/...2c39983d?hl=en

Cor
Jul 22 '05 #7
Thanks for your help Cor.

That was a great post by Willy. I was freeking out over nothing :-)

Started to make me worry. I will be testing this in the next few days.
Should be fine after reading Willy's post.

:-)

"Cor Ligthert" wrote:
Stingray,

As I said the taskmanager is not giving the correct figurs

Calling GC cost you performance. I assume you know that.

Have a look at a message from Willy in this newsgroup.

http://groups-beta.google.com/group/...2c39983d?hl=en

Cor

Jul 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Damian Greene | last post by:
I know this is an asp newsgroup, and I've gotten help from the group on several asp related questions, but I was hoping someone could answer a JScript question I wrote this script that was...
7
by: Randell D. | last post by:
Folks, I have a Javascript performance question that I might have problems explaining... In PHP, better performance can be obtained dealing directly with a variable, as opposed to an element...
55
by: Steve Jorgensen | last post by:
In a recent thread, RKC (correctly, I believe), took issue with my use of multiple parameters in a Property Let procedure to pass dimensional arguments on the basis that, although it works, it's...
5
by: Rasmus Kromann-Larsen | last post by:
Hey, I just started out using Visual C# (Visual Studio .NET 2003), but am having a little problem figuring out where to place my datastructure. I've worked with programming alot before, but this...
1
by: Natalia DeBow | last post by:
Hi, I am working on a Windows-based client-server application. I am involved in the development of the remote client modules. I am using asynchronous delegates to obtain information from...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
17
by: Fred Nelson | last post by:
Hi: I'm trying to implement an overall error handler in my VB.NET windows application. I need to place an "On Error Goto" in "Sub Main". I have tried to create a Sub Main and have had no...
0
by: Dave Coate | last post by:
I am working on a generic way to launch multiple similar processes (threads) at once, but limit the number of threads running at any one time to a number I set. As I understand it the following...
34
by: Mathieu Trentesaux | last post by:
Hello I downloaded Office 2007 for this reason : It seems, once again, that it is impossible to save any modification done in a VBA library, from the main project in Access. The save button...
9
by: Scott Stark | last post by:
Hello, I'm *just* delving into Windows forms-based programming without the benefit of any books, etc. I have a background in light ASP.NET work, so forgive me if this is a really basic question...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.