Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 24th, 2007, 4:37 PM   #1
Robocop
Programmer
 
Join Date: Sep 2004
Posts: 47
Rep Power: 0 Robocop is on a distinguished road
Making the form open once

What I want to do is to make it so that if the form is already opened, it shouln't open again until it is closed... also I don't want to use ShowDialog().

I tried this:
     frmSecondary frm = new frmSecondary();
     if (frm.Shown == false)
     {
          frm.Show();
     }

But I'm getting this error:
Error	1	The event 'System.Windows.Forms.Form.Shown' can only appear on the left hand side of += or -=
Robocop is offline   Reply With Quote
Old Jul 24th, 2007, 4:58 PM   #2
jaeusm
Programmer
 
jaeusm's Avatar
 
Join Date: Feb 2006
Location: Columbus, OH
Posts: 84
Rep Power: 3 jaeusm is on a distinguished road
'Shown' is an event, not a boolean value. You might want to consider the 'Visible' property.
jaeusm is offline   Reply With Quote
Old Jul 24th, 2007, 5:03 PM   #3
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
try something like this
csharp Syntax (Toggle Plain Text)
  1. frmSecondary frm = new frmSecondary();
  2. bool frmShow = false;
  3. if (frmShow == false)
  4. {
  5. frm.Show();
  6. }

also, i didnt compile the code, i just typed it out so let me know if it doesnt work right
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Jul 24th, 2007, 5:39 PM   #4
john Wesley
Hobbyist Programmer
 
john Wesley's Avatar
 
Join Date: May 2006
Location: United Kingdom
Posts: 119
Rep Power: 3 john Wesley is on a distinguished road
Send a message via MSN to john Wesley Send a message via Yahoo to john Wesley
Of course it wont work 'right' - the condition will never result to true.

What I suggest you do is track the forms Load and Closing events, setting variables appropriately so that conditional statements have a non-futile use.
__________________
Mona Lisa must of had the highway blues you can tell by the way she smiles..
john Wesley is offline   Reply With Quote
Old Jul 24th, 2007, 6:01 PM   #5
crawforddavid2006
Expert Programmer
 
crawforddavid2006's Avatar
 
Join Date: Apr 2005
Location: Not sure yet
Posts: 582
Rep Power: 0 crawforddavid2006 is an unknown quantity at this point
Send a message via AIM to crawforddavid2006 Send a message via MSN to crawforddavid2006
Quote:
Originally Posted by john Wesley View Post
Of course it wont work 'right' - the condition will never result to true.
well i knew you needed an else statement, i just didnt know what he wanted in there. i make 1 mistake and everyone is all over it
__________________
Quote:
Originally Posted by DaWei View Post
Well, it's better than Pen Islands url....;)

crawforddavid2006 is offline   Reply With Quote
Old Jul 25th, 2007, 8:04 AM   #6
john Wesley
Hobbyist Programmer
 
john Wesley's Avatar
 
Join Date: May 2006
Location: United Kingdom
Posts: 119
Rep Power: 3 john Wesley is on a distinguished road
Send a message via MSN to john Wesley Send a message via Yahoo to john Wesley
That one mistake could easily cause you headaches in the future - does you best to keep a sharp eye.
__________________
Mona Lisa must of had the highway blues you can tell by the way she smiles..
john Wesley is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
FFT DWTIB -> Optimization -> Choosing An Appropriate Run Time Sane Software Design and Algorithms 7 Dec 1st, 2006 10:40 AM
Show or hiding forms/modifying control properties ..from different a form.. cloud- C# 4 Nov 10th, 2006 10:51 AM
OnlineTextEditor.Com! Sane Show Off Your Open Source Projects 43 Jun 16th, 2006 8:55 AM
.NET Timer Form closing issue MBirchmeier C# 4 Nov 21st, 2005 10:00 AM
Can't open a different form... HappyTomato C# 2 Jul 18th, 2005 8:03 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:43 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC