ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • C# 라디오버튼과 그룹박스
    C#/WindowForm 2022. 3. 30. 03:22

    namespace _019_RadioBT
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
    
                string result = "";
                if (rb_Korea.Checked) //rb_Korea.Checked 체크되있으면 True값을 리턴
                    result += "국적 : 대한민국\n";
                else if (rb_China.Checked)
                    result += "국적 : 중국\n";
                else if (rb_Japan.Checked)
                    result += "국적 : 일본\n";
                else if (rb_Others.Checked)
                    result += "국적 : 그 외의 국가\n";
                
                if (rb_Male.Checked)
                    result += "성별 : 남성";
                else if (rb_Female.Checked)
                    result += "성별 : 여성";
    
                MessageBox.Show(result, "Result");
    
            }
        }
    }

    실행화면

     

    'C# > WindowForm' 카테고리의 다른 글

    ListBox  (0) 2022.04.06
    ComboBox  (0) 2022.04.06
    C# 체크박스  (0) 2022.03.30
    C# Flag  (0) 2022.03.30
    C# 윈도우 폼 메시지 박스  (0) 2022.03.30

    댓글

Designed by Tistory.