Click here to Skip to main content
11,923,046 members (62,490 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# .NET
Hello all,

I've been looking around but did not find an appropriate answer.

Is it possible to do the following:

I have three checkboxes on a Winform.

Now I create two settings files.

In settings1, all three checkboxes' checked state is TRUE by default.
In settings2, the default states are FALSE for each checkbox.

Is there any way to either apply setting1 or setting2 at runtime or at user interaction (button click, ...)?
Posted 2-Jan-13 2:44am
Michiel du Toit 2-Jan-13 7:54am
Hi Dennis,

You can use Environment.UserName to see which user is currently logged on to Windows.

You can use the Form's Load event to execute code when the form opens up.

Loading the settings from the file will depend on the type of file - if it is a text file you can use something like:
var myfile = new StreamReader(new FileStream("file.txt", FileAccess.Read));

More details are necessary if you want more help.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I am unable clearly understand your question..

But if you need to Check a CheckBox in runtime use :

Checkbox1.Enabled = true;
Checkbox2.Enabled = true;
Checkbox3.Enabled = true;
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hi Friend Little Bit Confusion but may it helps you

if(Setting1== true) // something that can make Settings condition true
Checkbox1.Enabled = true;
Checkbox2.Enabled = true;
Checkbox3.Enabled = true;"Setting1 Successfully Applied ");
Checkbox1.Enabled = false;
Checkbox2.Enabled = false;
Checkbox3.Enabled = false;"Setting2 Successfully Applied ");
there is many Events e.g(Button, Load, Check_Change etc) that can help to run these conditions

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
Web04 | 2.8.151125.3 | Last Updated 2 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