Click here to Skip to main content
12,622,652 members (27,734 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# Windows Win7
Can I declare a boolean variable by considering form loading.Ex:I need to declare a boolean variable, before the form loading "true" after the form loading "false".
Posted 9-Jan-13 22:51pm
Comments
Shanu2rick 10-Jan-13 3:54am
   
Winforms or Webforms?
NISHAN SANDEEPA 10-Jan-13 3:58am
   
Sorry dear... Winform.....
Shanu2rick 10-Jan-13 4:06am
   
See the solution 1, also declared the boolean variable in Load Event, set it to true. Then change the value on very next event you want.
NISHAN SANDEEPA 10-Jan-13 4:12am
   
Are there any alternatives for this without using a public variable.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Use the Form_Load event.
It will be much easier for you to start with a boolean false and then set it to true once the form_load event completes.
The bool flag remains false until the form is loaded.
  Permalink  
Comments
NISHAN SANDEEPA 10-Jan-13 4:20am
   
Can I use a variable between InitializeComponent().If it is can please give me an example.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100