Click here to Skip to main content
13,256,716 members (51,318 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
Comments
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));
myfile.ReadLine();

More details are necessary if you want more help.
Dennis Bork 2-Jan-13 13:50pm
   
Hello Michiel, I use the method described here: http://msdn.microsoft.com/en-us/library/k4s6c3a0.aspx - is there any way to have multiple configurations?
Rate this: bad
 
good
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;
  Permalink  
Comments
Dennis Bork 2-Jan-13 9:49am
   
Mohammed, my question is about user settings, not about how to set the checked state of a checkbox. Thanks anyways :)
Rate this: bad
 
good
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;
MessageBox.show("Setting1 Successfully Applied ");
}
if(Setting2==true)
{
Checkbox1.Enabled = false;
Checkbox2.Enabled = false;
Checkbox3.Enabled = false;
MessageBox.show("Setting2 Successfully Applied ");
}
there is many Events e.g(Button, Load, Check_Change etc) that can help to run these conditions
thanks
  Permalink  
Comments
Dennis Bork 2-Jan-13 10:51am
   
Sorry, but you also don't get the point :) Am I so unclear? It's about application and user settings as described here: http://msdn.microsoft.com/en-us/library/k4s6c3a0.aspx

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 |
Web01 | 2.8.171114.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2017
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