I`m trying to get the items in of my checkedboxlist that is in form1 from my form2.
I did put the propertie of my form1.checkedboxlist MODIFIER to PUBLIC
I can reach the list but i can`t get the items inside. When i used the checkedboxlist.items.count it tells me there is nothing in my list but it is not true
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();
}
thank you for your help
Try with
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();
}
Here' are two links to very similar questions asked and solutions I've offered them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.