Avatar

Level 1

Hi All,

Is that possible help me to improve the following code in "For Loop" ?

I have 7 radio button, sh1_g to sh7_g, there are a lot of combination to go through.

code as follows:

if(sh1_g.rawValue == "1" && sh2_g.rawValue == "1")

{

    Page4.g1_name.rawValue=sh1_name.rawValue;

          Page4.g1_nric.rawValue=sh1_nric.rawValue;

          Page5.g2_name.rawValue=sh2_name.rawValue;

          Page5.g2_nric.rawValue=sh2_nric.rawValue;

}

else if(sh1_g.rawValue == "1" && sh2_g.rawValue == "2")

{

    Page4.g1_name.rawValue=sh1_name.rawValue;

          Page4.g1_nric.rawValue=sh1_nric.rawValue;

          Page5.g2_name.rawValue=null;

          Page5.g2_nric.rawValue=null;

}

else if(sh1_g.rawValue == "2" && sh2_g.rawValue == "1")

{

    Page4.g1_name.rawValue=sh2_name.rawValue;

          Page4.g1_nric.rawValue=sh2_nric.rawValue;

          Page5.g2_name.rawValue=null;

          Page5.g2_nric.rawValue=null;

}

else

{

          Page4.g1_name.rawValue=null;

          Page4.g1_nric.rawValue=null;

          Page5.g2_name.rawValue=null;

          Page5.g2_nric.rawValue=null;

}

Thanks!

Marcus