473,396 Members | 1,961 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,396 software developers and data experts.

how do i manage my form instances

Hi,

Does anyone have any example of how i can manage forms in
my application??

I want to be able to reference my form instances that are
currently open from other forms.

why cant i open and close forms as easily as in VB6??

i.e if i have formHomepage open and i click on a link to
open form2 i use

Dim frm2 as new form2
frm2.show

however i wnat to be able to open the same formHomepage
instance from within my frm2 instance.

is there a way to do this? Does anyone have any code
example or managing form instabnces or any useful
articles for vb.net??

i would really appreciate any help

thx
Jul 21 '05 #1
4 2146
Tonya:

I'm not putting down VB6, but there's nothing object oriented about using
things that just exist, that don't need to be instantiated. When you call
close in .NET, it fires .Disposes shortly thereafter and the form is no
longer available. You can choose to override the closing events of your
forms and make them invisible, then instead of calling show make them
visible again. However, you'd need to keep them all scoped and this is not
an approach I'd suggest. Instead, I'd recommend creating objects to hold
those form variables that you need and pass them in to the forms constructor
which you can overload or once the form loads, set whatever properties to
the given object's values.

The whole concept of managing forms is going to be quite different then your
experience with VB6 because forms and many other things are radical
departures form the old way. You can create objects/modules that hold all
of this data and get you wherever you want to be but IMHO, managing specific
forms all over an application is something I'm not sad to see go away.

If you can show me specifically what problem you're having, I'll be glad to
try to help you accomplish what you need.

HTH,

Bill
"Tonya" <s@m> wrote in message
news:02****************************@phx.gbl...
Hi,

Does anyone have any example of how i can manage forms in
my application??

I want to be able to reference my form instances that are
currently open from other forms.

why cant i open and close forms as easily as in VB6??

i.e if i have formHomepage open and i click on a link to
open form2 i use

Dim frm2 as new form2
frm2.show

however i wnat to be able to open the same formHomepage
instance from within my frm2 instance.

is there a way to do this? Does anyone have any code
example or managing form instabnces or any useful
articles for vb.net??

i would really appreciate any help

thx

Jul 21 '05 #2
Hi William,
thx for your input.

what i want to achieve is to be able to show a form
instance that has alreay been opened. When i open my
application formHomepage is opened as the starting form.
On this form i have 4 buttons that open 4 other forms.
When i click a button form2 is displayed and is shown
above formHomepage. However when i try to go back to my
homepage from form2 a new instance of formhomepage is
opened!!! Now i have 2 instances of the same form. This
is not what i want. I want to show the instance that is
already open. This is what i need help coding.

As u have probably guessed i am a beginner to VB.NET and
am finding things very difficult to get used to!!

any help or advise u could give is very much appreciated.

-----Original Message-----
Tonya:

I'm not putting down VB6, but there's nothing object oriented about usingthings that just exist, that don't need to be instantiated. When you callclose in .NET, it fires .Disposes shortly thereafter and the form is nolonger available. You can choose to override the closing events of yourforms and make them invisible, then instead of calling show make themvisible again. However, you'd need to keep them all scoped and this is notan approach I'd suggest. Instead, I'd recommend creating objects to holdthose form variables that you need and pass them in to the forms constructorwhich you can overload or once the form loads, set whatever properties tothe given object's values.

The whole concept of managing forms is going to be quite different then yourexperience with VB6 because forms and many other things are radicaldepartures form the old way. You can create objects/modules that hold allof this data and get you wherever you want to be but IMHO, managing specificforms all over an application is something I'm not sad to see go away.
If you can show me specifically what problem you're having, I'll be glad totry to help you accomplish what you need.

HTH,

Bill
"Tonya" <s@m> wrote in message
news:02****************************@phx.gbl...
Hi,

Does anyone have any example of how i can manage forms in my application??

I want to be able to reference my form instances that are currently open from other forms.

why cant i open and close forms as easily as in VB6??

i.e if i have formHomepage open and i click on a link to open form2 i use

Dim frm2 as new form2
frm2.show

however i wnat to be able to open the same formHomepage
instance from within my frm2 instance.

is there a way to do this? Does anyone have any code
example or managing form instabnces or any useful
articles for vb.net??

i would really appreciate any help

thx

.

Jul 21 '05 #3
Tonya:

If you have code in form1 for instance that Shows form2.....
Button_Click(blah blah) handles button1.click
Dim f as New form2
f.ShowDialog()

Then you close form2, you should be back at Form1. However, if you are
dimming a new Form1 in Form2, you'll have a new form. If Form1 is your
main form, you may well want to make it an MDI form so that no matter what,
you'll always come back to it when you close all of the other windows.

Every time you dim something as New, you have a totally new object. You can
declare a zillion different instances of Form1 that are totally distinct so
you need ot be aware of that when you are calling instances. Also, you may
want to use ShowDialog instead of Show depending on your specific situation,
which will show a form Modally instead of just showing it. In VB6, Form2
always stayed alive and it was never born as such in the code. You could
call its show method from anywhere. However, in VB.NET, let's say you have
Form1 in your project, but you use thsi code alone Form1.Show, it won't work
because it's never been instantiated. And since the form is 'born' it can
die which occurs when it's closed (how it actually dies is another story but
Garbage collection is a whole different issue).

Anyway, I hope I answered your question, but if not, let me know and I'll do
what I can.

HTH,

Bill
"Tonya" <an*******@discussions.microsoft.com> wrote in message
news:0b****************************@phx.gbl...
Hi William,
thx for your input.

what i want to achieve is to be able to show a form
instance that has alreay been opened. When i open my
application formHomepage is opened as the starting form.
On this form i have 4 buttons that open 4 other forms.
When i click a button form2 is displayed and is shown
above formHomepage. However when i try to go back to my
homepage from form2 a new instance of formhomepage is
opened!!! Now i have 2 instances of the same form. This
is not what i want. I want to show the instance that is
already open. This is what i need help coding.

As u have probably guessed i am a beginner to VB.NET and
am finding things very difficult to get used to!!

any help or advise u could give is very much appreciated.

-----Original Message-----
Tonya:

I'm not putting down VB6, but there's nothing object

oriented about using
things that just exist, that don't need to be

instantiated. When you call
close in .NET, it fires .Disposes shortly thereafter and

the form is no
longer available. You can choose to override the

closing events of your
forms and make them invisible, then instead of calling

show make them
visible again. However, you'd need to keep them all

scoped and this is not
an approach I'd suggest. Instead, I'd recommend

creating objects to hold
those form variables that you need and pass them in to

the forms constructor
which you can overload or once the form loads, set

whatever properties to
the given object's values.

The whole concept of managing forms is going to be quite

different then your
experience with VB6 because forms and many other things

are radical
departures form the old way. You can create

objects/modules that hold all
of this data and get you wherever you want to be but

IMHO, managing specific
forms all over an application is something I'm not sad

to see go away.

If you can show me specifically what problem you're

having, I'll be glad to
try to help you accomplish what you need.

HTH,

Bill
"Tonya" <s@m> wrote in message
news:02****************************@phx.gbl...
Hi,

Does anyone have any example of how i can manage forms in my application??

I want to be able to reference my form instances that are currently open from other forms.

why cant i open and close forms as easily as in VB6??

i.e if i have formHomepage open and i click on a link to open form2 i use

Dim frm2 as new form2
frm2.show

however i wnat to be able to open the same formHomepage
instance from within my frm2 instance.

is there a way to do this? Does anyone have any code
example or managing form instabnces or any useful
articles for vb.net??

i would really appreciate any help

thx

.

Jul 21 '05 #4
Hi William,

Is there anyway i can handle my forms as if i were using
VB6?? i.e if I want to be able to refernce the controls
that are on form3 while i am in form2.

Is there no way of referencing an already instantiated
form?

btw, thx for your book recommendation last time on
ADO.NET. it proved very useful :o)
-----Original Message-----
Tonya:

If you have code in form1 for instance that Shows form2.....Button_Click(blah blah) handles button1.click
Dim f as New form2
f.ShowDialog()

Then you close form2, you should be back at Form1. However, if you aredimming a new Form1 in Form2, you'll have a new form. If Form1 is yourmain form, you may well want to make it an MDI form so that no matter what,you'll always come back to it when you close all of the other windows.
Every time you dim something as New, you have a totally new object. You candeclare a zillion different instances of Form1 that are totally distinct soyou need ot be aware of that when you are calling instances. Also, you maywant to use ShowDialog instead of Show depending on your specific situation,which will show a form Modally instead of just showing it. In VB6, Form2always stayed alive and it was never born as such in the code. You couldcall its show method from anywhere. However, in VB.NET, let's say you haveForm1 in your project, but you use thsi code alone Form1.Show, it won't workbecause it's never been instantiated. And since the form is 'born' it candie which occurs when it's closed (how it actually dies is another story butGarbage collection is a whole different issue).

Anyway, I hope I answered your question, but if not, let me know and I'll dowhat I can.

HTH,

Bill
"Tonya" <an*******@discussions.microsoft.com> wrote in messagenews:0b****************************@phx.gbl...
Hi William,
thx for your input.

what i want to achieve is to be able to show a form
instance that has alreay been opened. When i open my
application formHomepage is opened as the starting form.
On this form i have 4 buttons that open 4 other forms.
When i click a button form2 is displayed and is shown
above formHomepage. However when i try to go back to my
homepage from form2 a new instance of formhomepage is
opened!!! Now i have 2 instances of the same form. This
is not what i want. I want to show the instance that is
already open. This is what i need help coding.

As u have probably guessed i am a beginner to VB.NET and
am finding things very difficult to get used to!!

any help or advise u could give is very much appreciated.
>-----Original Message-----
>Tonya:
>
>I'm not putting down VB6, but there's nothing object

oriented about using
>things that just exist, that don't need to be

instantiated. When you call
>close in .NET, it fires .Disposes shortly thereafter and
the form is no
>longer available. You can choose to override the

closing events of your
>forms and make them invisible, then instead of calling

show make them
>visible again. However, you'd need to keep them all

scoped and this is not
>an approach I'd suggest. Instead, I'd recommend

creating objects to hold
>those form variables that you need and pass them in to

the forms constructor
>which you can overload or once the form loads, set

whatever properties to
>the given object's values.
>
>The whole concept of managing forms is going to be
quite different then your
>experience with VB6 because forms and many other things

are radical
>departures form the old way. You can create

objects/modules that hold all
>of this data and get you wherever you want to be but

IMHO, managing specific
>forms all over an application is something I'm not sad

to see go away.
>
>If you can show me specifically what problem you're

having, I'll be glad to
>try to help you accomplish what you need.
>
>HTH,
>
>Bill
>"Tonya" <s@m> wrote in message
>news:02****************************@phx.gbl...
>> Hi,
>>
>> Does anyone have any example of how i can manage
forms in
>> my application??
>>
>> I want to be able to reference my form instances that

are
>> currently open from other forms.
>>
>> why cant i open and close forms as easily as in VB6??
>>
>> i.e if i have formHomepage open and i click on a link

to
>> open form2 i use
>>
>> Dim frm2 as new form2
>> frm2.show
>>
>> however i wnat to be able to open the same

formHomepage >> instance from within my frm2 instance.
>>
>> is there a way to do this? Does anyone have any code
>> example or managing form instabnces or any useful
>> articles for vb.net??
>>
>> i would really appreciate any help
>>
>> thx
>
>
>.
>

.

Jul 21 '05 #5

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

Similar topics

16
by: David Lauberts | last post by:
Hi Wonder if someone has some words of wisdom. I have a access 2002 form that contains 2 graph objects that overlay each other and would like to export them as a JPEG to use in a presentation....
12
by: (Pete Cresswell) | last post by:
I know I can open many instances of a given form, but I've never done it. Now I'm analyzing an application where that seems like just the ticket: Many investment funds, *lots* of data points for...
0
by: RonNanko | last post by:
Hi, let me first explain what my problem is all about: I have a third-party application, which does not allow multiple instances of itself. As I need to run the application in multiple instances...
4
by: Remi Hugnon | last post by:
Hi, I want to build an expandable treeview. I saw some code on VB but I know only C# I plan for my class that each nodes has its own id (using span for example). Into a single aspx page...
4
by: Tonya | last post by:
Hi, Does anyone have any example of how i can manage forms in my application?? I want to be able to reference my form instances that are currently open from other forms. why cant i open...
7
by: Terry | last post by:
I have a Mainform with a Statusbar. When opening another form or doing some processing I want to display info in the Statusbar of the Mainform. I have read a lot of articles on this & have come up...
4
by: GGerard | last post by:
Hello I have a program where the user can open as many instances of a form as the user wants. The only limit to how many instances can be opened is determined by the limit of the computer...
1
by: Eric Sadoyama | last post by:
I have a database documentation question, but I am not even sure how to phrase it properly so I don't know where to start looking for answers. We are developing a database that is based on...
5
by: Neil | last post by:
"lyle" <lyle.fairfield@gmail.comwrote in message news:48c3dde7-07bd-48b8-91c3-e157b703f92b@f3g2000hsg.googlegroups.com... Question for you. I'm doing something similar, only, instead of opening...
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: 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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.