472,333 Members | 1,132 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 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 2040
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...
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: ...
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...
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...
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...
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...
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...
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. ...
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...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.