Checkbox State Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Prodian
    New Member
    • Jan 2008
    • 16

    Checkbox State Question

    This is my first post so be easy on me please.

    Im using a INI parser to read and write to an ini file. When reading the ini file I have certain parameters set to 1 or 0, which need to be stored to a checkbox variable. Heres a peice of code for reading the ini file.

    Code:
                string whispernotify = source.Configs["Settings"].Get("whisper_notify");
                
                if (whispernotify == "1")
                {
                    whisper_notify.Checked = true;
                }
                else
                {
                    whisper_notify.Checked = false;
                 }
    Its working fine but the problem occurs when Im writing back to the ini file. Heres the write back sample:

    Code:
    source.Configs["Settings"].Set ("whisper_notify", whisper_notify.Checked);
    In the ini file its coming up with a "True" or "False" not a 1 or 0 like I need. Ive spent several hours trying different things. Any help pointing me in the right direction would be awesome. Thanks.
  • lotus18
    Contributor
    • Nov 2007
    • 865

    #2
    What language are you using?

    Comment

    • daniel aristidou
      Contributor
      • Aug 2007
      • 494

      #3
      I think this is in the wrong forum...code looks like .net or C

      Comment

      • Prodian
        New Member
        • Jan 2008
        • 16

        #4
        its C# visual, but i got it working with this
        Code:
        if (use_smtp.Checked == true)
                    {
                        source.Configs["Settings"].Set("use_smtp","1");
                    }
                    else
                    {
                        source.Configs["Settings"].Set("use_smtp","0");
                    }

        Comment

        Working...