473,770 Members | 4,198 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2191
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(bl ah 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*******@disc ussions.microso ft.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(b lah 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*******@disc ussions.microso ft.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
11880
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. I can do this individually for each graph but this does not help me as I need both on the same JPEG. I thought I would try an export the form that contains both but I am having trouble. (My VBA is self taught and a little knowledge is...
12
3237
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 each fund, and a desire by the users to see several funds presented side-by-side. Is opening, say, five instances of the same form real-world-doable? -- PeteCresswell
0
2086
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 (it is processing data, a job which can be neatly parallelized) I have created five user accounts on my XP Home system, log in as every one of these users and launch the application in each session, which works fine. (BTW: is the number of users...
4
2193
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 without any other control, it's very easy because I play on URL and parameters and refresh my aspx. But in a screen having 2 treeview, I have the param and other controls. How can I organize my object in order to catch (meaning server side) wich node
4
297
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 and close forms as easily as in VB6??
7
3389
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 with the code below. It seems to work(!!!) in that when coding the second form I can see the DisplayStatusMsg of the main form. During debug the code runs through & seemingly executes the call without error. But!...The message is not displayed....
4
3292
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 itself (the amount of RAM - I think). When enough instances of this form are opened and the limit of the computer is reached
1
2303
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 several different data standards and schema. I'm finding it confusing to keep it all straight. What's this field for? Which standards document is it based on? What are the permitted values? Which business rule governs it? In theory, we do have all...
5
3311
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 the forms all at once, I'm opening them as needed. I have a main form with multiple records; and then I have a pop-up form that the user opens with button. The pop-up form contains one record relating to the current record in the main form (but...
0
9592
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10005
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8887
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6679
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.