Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET WinForm
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 at 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.
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  
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  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 2 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