기본 콘텐츠로 건너뛰기

7월, 2017의 게시물 표시

C# - CheckedList 사용법

if (checkedListBox1.CheckedItems.Count != 0) { // If so, loop through all checked items and print results. string s = "" ; for ( int x = 0; x <= checkedListBox1.CheckedItems.Count - 1 ; x++) { s = s + "Checked Item " + (x+1).ToString() + " = " + checkedListBox1.CheckedItems[x].ToString() + "\n" ; } MessageBox.Show (s); }

C# - Radiobutton 여러개 일경우 선택된 Radiobutton 값 가져오기

1. RadioButton 의 CheckedChanged 이벤트 핸들러 생성. string winder_empty_tray_text;         private void radioButton_WinderEmptyTray_CheckedChanged(object sender, EventArgs e)         {             if (((RadioButton)sender).Checked)                 winder_empty_tray_text = ((RadioButton)sender).Text;             string[] tempstr = winder_empty_tray_text.Split('-');             winder_empty_tray_text = tempstr[0].Trim();         } 2. 그룹으로 묶인 Radiobutton 들의 CheckedChanged 이벤트에 위 1번에서 생성한 이벤트 핸들러를 동일하게 추가.