0

form2からform1にあるcheckedboxlistのアイテムを取得しようとしています。

form1.checkedboxlist MODIFIER のプロパティを PUBLIC に設定しました

リストにアクセスできますが、中のアイテムを取得できません。私がcheckedboxlist.items.countを使用すると、リストに何もないことがわかりますが、そうではありません

string[] list = new string[form1.ckdBoxList.Items.Count];

MessageBox.Show(list.Length.ToString());//In debug it tells me that the lenght is 0

for (int i = 0; i <= list.Length; i++)
{
   list[i] = fenPrincipal.ckdBoxList.Items[i].ToString();
}

ご協力ありがとうございました

4

2 に答える 2

0

試してみてください

    string[] list = new string[form1.ckdBoxList.Items.Count];

    MessageBox.Show(form1.ckdBoxList.Items.Count+"");//In debug it tells me that the lenght is 0

    for (int i = 0; i < form1.ckdBoxList.Items.Count; i++)
    {
        list[i] = form1.ckdBoxList.Items[i].ToString();
    }
于 2012-04-25T17:37:43.433 に答える
0

これは、よく似た質問と私が提供した解決策への 2 つのリンクです。

解決策 1

別のオプション

于 2012-04-25T17:38:03.240 に答える