Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# 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 21:51pm
Comments
Shanu2rick at 10-Jan-13 3:54am
   
Winforms or Webforms?
NISHAN SANDEEPA at 10-Jan-13 3:58am
   
Sorry dear... Winform.....
Shanu2rick at 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 at 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 at 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
0 OriginalGriff 364
1 DineshMaind 95
2 Sergey Alexandrovich Kryukov 94
3 majid torfi 83
4 kbrandwijk 75
0 Zubair MCA 55
1 OriginalGriff 55
2 sankarsan parida 55
3 harshavardhan12345678 45
4 Sandeep Londhe 45


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2014
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