私はC#でプログラミングしています.文字列「xml」にいくつかのものを入れる必要があります
次のコードがあります
TextBox[] myTextBoxes = new TextBox[] { this.textBox2, this.textBox3, this.textBox4, this.textBox5, this.textBox6, this.textBox7, this.textBox8, this.textBox9, this.textBox10, this.textBox11 };
TextBox[] ValueBoxes = new TextBox[] { this.textBox3, this.textBox5, this.textBox7, this.textBox9, this.textBox11 };
CheckBox[] myCheckBoxes = new CheckBox[] { this.checkBox2, this.checkBox4, this.checkBox6, this.checkBox8, this.checkBox10 };
CheckBox[] myMandBoxes = new CheckBox[] { this.checkBox3, this.checkBox5, this.checkBox7, this.checkBox9, this.checkBox11 };
そして、私が持っている特定の状態を確認するために
xml += "<fields>";
for (int i = 0; i < myTextBoxes.Length; i++)
{
if (string.IsNullOrWhiteSpace(myTextBoxes[i].Text))
{
if (myCheckBoxes[i].Checked == true)
xml += "<field display='yes'> ";
else
xml += "<field display='no'> ";
if (myMandBoxes[i].Checked == true)
xml += "<mandatory='yes'>";
else
xml += "<Mandatory='no'>";
xml += "<label>" + (string)myTextBoxes[i].Text + "</label>";
}
}
if (myCheckBoxes[i].Checked == true) で Indexoutof boud 例外が発生します
どうすればこれを解決できますか