2012-04-25 5 views
0

내 form2에있는 form1에있는 체크 박스 목록의 항목을 가져 오려고합니다.C# 내 form2에서 form1의 체크 박스 항목 가져 오기

나는 목록에 도달 할 수 있습니다하지만 난 내 아이템을 얻을은`t PUBLIC

내 form1.checkedboxlist MODIFIER의 propertie를 넣어 않았다. 내가 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(); 
} 

+1

은 Form1이 여전히 열려 볼 수 있습니까? – mellamokb

답변

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(); 
    } 
+0

대단히 감사합니다 – pharaon450

0

으로 시도 당신의 도움을 주셔서 감사 사실이 아니다 알려줍니다 매우 유사한 질문에 대한 두 개의 링크이며 내가 제공 한 솔루션입니다. 당신이 Form2를 전환 할 때

Solution option 1

Another option

+0

대단히 감사합니다 – pharaon450

관련 문제