Click here to Skip to main content
15,893,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
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

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.
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900