Click here to Skip to main content
11,582,850 members (69,514 online)
Rate this: bad
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
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
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.
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 365
1 virusstorm 209
2 Sergey Alexandrovich Kryukov 205
3 Kornfeld Eliyahu Peter 160
4 Andy Lanng 144
0 OriginalGriff 1,403
1 Sergey Alexandrovich Kryukov 970
2 Abhinav S 696
3 F-ES Sitecore 505
4 Suvendu Shekhar Giri 503

Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2015
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