.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 15th, 2003, 10:55 AM
Pain Pain is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Sheffield, UK
Posts: 94 Pain User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
Send a message via ICQ to Pain
checking to see if a particular form is loaded

Hi guys

my solution has multiple forms/data forms. I reference between them,and can get them to popup/close down as needed.

If my form has a button, and the user clicks on it, the new form will show. However, if the user then clicks again on the button, a new instance of the same form appears.

Is there any way to check to see if the form is open/loaded/showing/anything but not loaded, and if it is just to gain focus to it again, rather than having a new instance?

Sounds really complicated, but im sure someone has come across this problem before.

Ideally, i'd want it where no matter how many times the button is pressed, only one new form appears.

Can you help?

Thanks!

Chris

Reply With Quote
  #2  
Old October 15th, 2003, 12:33 PM
Pain Pain is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Sheffield, UK
Posts: 94 Pain User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
Send a message via ICQ to Pain
Followup to previous post.

I believe im after something called the "singleton class".

Anyone got any info?

Reply With Quote
  #3  
Old October 15th, 2003, 02:08 PM
CCDemonX's Avatar
CCDemonX CCDemonX is offline
WebDeveloper++;
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: New York City
Posts: 85 CCDemonX User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
You could do what I do. You could place a bool variable called for example, isOpened in the top level form class, then check to see if its true or false before opening the form.
PHP Code:
public bool isOpened;

// ...

if(isOpened == false)
{
    
WinForm1 aboutWindow = new WinForm1();
    
aboutWindow.Show();
    
isOpened true;



then to set isOpened back to false set an event for when the form is closed.

Last edited by CCDemonX : October 15th, 2003 at 02:15 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > checking to see if a particular form is loaded

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap