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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Guruprasad.K.Basavaraju 424
1 Sergey Alexandrovich Kryukov 336
2 Shai Vashdi 318
3 OriginalGriff 265
4 Abhinav S 150
0 Sergey Alexandrovich Kryukov 9,169
1 OriginalGriff 5,290
2 Peter Leow 4,020
3 Maciej Los 3,535
4 Abhinav S 3,263


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid