[英]c# getting items of my checkedboxlist in form1 from my form2
我正在嘗試從form2獲取form1中我的checkboxboxlist中的項目。
我的確把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();
}
謝謝您的幫助
試試看
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();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.