Notice
Recent Posts
Recent Comments
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Archives
Today
Total
관리 메뉴

충분히 쌓여가는

실습하기 3-9 그룹박스 컨트롤로 컨트롤 묶기 본문

비주얼 베이직/03 윈도 폼 컨트롤

실습하기 3-9 그룹박스 컨트롤로 컨트롤 묶기

빌드이너프 2024. 5. 27. 21:18

체크박스와 라디오버튼 컨트롤을 그룹박스 컨트롤로 묶고 연령별로 좋아하는 색을 선택하여 출력

 

3) <확인> 버튼을 더블클릭하여 코드 작성

Public Class Form1
    Private Sub GroupBox2_Enter(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim str As String

        str = "연령은" & Chr(13)
        If RadioButton1.Checked = True Then str = str & RadioButton1.Text
        If RadioButton2.Checked = True Then str = str & RadioButton2.Text
        If RadioButton3.Checked = True Then str = str & RadioButton3.Text
        If RadioButton4.Checked = True Then str = str & RadioButton4.Text
        If RadioButton5.Checked = True Then str = str & RadioButton5.Text
        If RadioButton6.Checked = True Then str = str & RadioButton6.Text

        str = str & Chr(13) & "좋아하는 색은" & Chr(13)
        If CheckBox1.Checked = True Then str = str & CheckBox1.Text & Chr(13)
        If CheckBox2.Checked = True Then str = str & CheckBox2.Text & Chr(13)
        If CheckBox3.Checked = True Then str = str & CheckBox3.Text & Chr(13)
        If CheckBox4.Checked = True Then str = str & CheckBox4.Text & Chr(13)
        If CheckBox5.Checked = True Then str = str & CheckBox5.Text & Chr(13)
        If CheckBox6.Checked = True Then str = str & CheckBox6.Text & Chr(13)
        
        str = str & "입니다."
        Label1.Text = str
    End Sub
End Class

 

실습

 

실행