Blake Arnold

Blake Arnold

  • NA
  • 30
  • 0

Simplify Loop

Nov 15 2007 3:40 PM
I have this piece of code that i would like to simplify because I know that i will be adding more checkboxes in the future. Can any one help me to simplify this? Also, I already declared the string strSubscription in above code.

        //Assign database name to strings
        if (chbAll1t60.Checked == true)
        {
            strSubscription += "xXpoOFAd";
            if (chbAll60t70.Checked == true)
            {
                strSubscription += ":wE9z4HjJ";
            }
            else
            {
                if (chbHor1t60.Checked == true)
                {
                    strSubscription += ":yRczF320";
                }
                else
                {
                    if (chbHor60t70.Checked == true)
                    {
                        strSubscription += ":8qz1ExKb";
                    }
                }
            }
        }
        else
        {
            if (chbAll60t70.Checked == true)
            {
                strSubscription += "wE9z4HjJ";
                if (chbHor1t60.Checked == true)
                {
                    strSubscription += ":yRczF320";
                }
                else
                {
                    if (chbHor60t70.Checked == true)
                    {
                        strSubscription += ":8qz1ExKb";
                    }
                }
            }
            else
            {
                if (chbHor1t60.Checked == true)
                {
                    strSubscription += "yRczF320";
                    if (chbHor60t70.Checked == true)
                    {
                        strSubscription += ":8qz1ExKb";
                    }
                }
                else
                {
                    if (chbHor60t70.Checked == true)
                    {
                        strSubscription += "8qz1ExKb";
                    }
                }
            }
        }


Answers (4)