473,507 Members | 4,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Form in c# ?

WJ
I am using SDI model. How do I check if a Form is already exists in a c#
Windows Application so that I do not have to create another instance,
istead, just doing the "formName.show()" ?

Thanks

John
Nov 15 '05 #1
5 1344

"WJ" <JW***@Msn2.Com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I am using SDI model. How do I check if a Form is already exists in a c#
Windows Application so that I do not have to create another instance,
istead, just doing the "formName.show()" ?


Stringe question... The main SDI Window will be there for the lifetime of
the application. Any additional Window will be created by you and you will
have full control over it. If you feel that disposal and recreation is
expensive, just hang on to your reference.

Martin.
Nov 15 '05 #2
L#
On Sun, 1 Feb 2004 15:44:16 -0500, "WJ" <JW***@Msn2.Com> wrote:
I am using SDI model. How do I check if a Form is already exists in a c#
Windows Application so that I do not have to create another instance,
istead, just doing the "formName.show()" ?

Thanks

John


What about:

if (form == null)
form = new Form();
form.Show();
--
Ludwig
mailto:ludwig_(nospamplease)stuyck@pandora(nospamp lease).be
Nov 15 '05 #3
WJ
"L#" <ludwig_(nospamplease)stuyck@pandora(nospamplease) .be> wrote in message
news:pq********************************@4ax.com...
if (form == null)
form = new Form();
form.Show();

Yep. That works. Thanks

John
Nov 15 '05 #4
WJ

"Martin Maat [EBL]" <du***@somewhere.nl> wrote in message
news:10*************@corp.supernews.com...

Stringe question... The main SDI Window will be there for the lifetime of
the application. Any additional Window will be created by you and you will
have full control over it. If you feel that disposal and recreation is
expensive, just hang on to your reference.

Not strange at all. Sometimes you do not do Dispose() but the object
disappears on you (in a blue moon) anyway, other times you would forget to
call Dispose() and endup filling up all precious RAM. As a result, it is
always a good practice to make sure the thing exists before you reference
it. Otherwise, create it.

John
Nov 15 '05 #5
"WJ" <JW***@Msn2.Com> wrote in message
news:uF**************@TK2MSFTNGP09.phx.gbl...

"Martin Maat [EBL]" <du***@somewhere.nl> wrote in message
news:10*************@corp.supernews.com...

Strange question... The main SDI Window will be there for the lifetime of the application. Any additional Window will be created by you and you will have full control over it. If you feel that disposal and recreation is
expensive, just hang on to your reference.
Not strange at all. Sometimes you do not do Dispose() but the object
disappears on you (in a blue moon) anyway.


No, if this were a possibility it would be pointless to write any code. You
should find why this is happening and fix your code.

It seems like you are keeping weak references in some way and then unrightly
expect the object to remain.

Martin.
Nov 15 '05 #6

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

Similar topics

5
73178
by: RAJ | last post by:
hi plz tell me how to know "how window is going to close"... i have to right code for X button of forms... plz telll me thanks bye
6
2527
by: Ayende Rahien | last post by:
Excetremely annoying problem, I've an application with a long startup time. So I created another form with my logo in it to as a splash screen. The splash screen is run from another thread and is...
4
464
by: Bilo | last post by:
I have a Windows Forms Class MainGUI I have declared MainGUI maingui; public System.ComponentModel.Container components = new Container(); in the Class I call another class MediaDriver with...
9
2799
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am...
7
1900
by: MounilK | last post by:
Hi all, I am not sure if this is the right NG to post this question. If that's the case please point me to the correct NG. I have a class library(myLib.dll) which has a class(myClass) which has...
1
3435
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
8
18618
by: Alison | last post by:
Hi, Al I am trying to design a user interface which provides both menus and toolbars for some users to click on whatever they want to do, at the same time, I would like to have a console window...
4
3130
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
15
7044
by: =?Utf-8?B?TVNU?= | last post by:
To demonstrate my problem, I have a very simple VB Windows application. It has a text box that is used to display a counter, a button to reset the counter, and a timer that increments the counter...
21
3287
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
7220
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
7308
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
7371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7023
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...
0
7479
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...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4702
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...
0
1534
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 ...
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.