2013-03-09 5 views
2

나는 이런 식으로 뭔가를하고 싶습니다.체크 박스 목록에서 항목 문자열 가져 오기

String s = ""; 
foreach (var item in checkedListBox1.Items) 
{ 
     s = checkedListBox1.Items(item).tostring; 
     // do something with the string 
} 

목록 상자에있는 항목의 string을 갖고 싶습니다.

어떻게하면 되나요? 아마

foreach (var item in checkedListBox1.Items) 
{ 
    checkedListBox1.GetItemText(item); 
} 

아니라 가장 유용하지만, 그것을 위해 here is the MSDN :

답변

1

아직 시도하지는 않았지만 제대로 작동해야한다고 생각합니다.

string s = ""; 
foreach (var item in checkedListBox1.Items) 
{ 
     s = item.ToString(); 
     // do something with the string 
} 
+0

내 테스트에서()를 잊어 버렸습니다 ... 죄송합니다. – tux007

0
string s = ""; 
foreach (string item in checkedListBox1.Items) 
{ 
    s = item; 
    // do something with the string 

} 
0

나는 당신을 위해 무엇을 찾고있는 것은이 믿습니다.

관련 문제