Public Class Form1

    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Checkbox1.CheckedChanged
        If Checkbox1.Checked Then TextBox2.Visible = True Else TextBox2.Visible = False
    End Sub

    Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
        If CheckBox2.Checked Then TextBox3.Visible = True Else TextBox3.Visible = False
    End Sub

    Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox3.CheckedChanged
        If CheckBox3.Checked Then TextBox4.Visible = True Else TextBox4.Visible = False
    End Sub

    Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged
        If CheckBox4.Checked Then TextBox5.Visible = True Else TextBox5.Visible = False
    End Sub

    Private Sub CheckBox5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox5.CheckedChanged
        If CheckBox5.Checked Then TextBox6.Visible = True Else TextBox6.Visible = False
    End Sub

    Private Sub CheckBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox6.CheckedChanged
        If CheckBox6.Checked Then TextBox7.Visible = True Else TextBox7.Visible = False
    End Sub

    Private Sub CheckBox7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox7.CheckedChanged
        If CheckBox7.Checked Then TextBox8.Visible = True Else TextBox8.Visible = False
    End Sub

    Private Sub CheckBox8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox8.CheckedChanged
        If CheckBox8.Checked Then TextBox9.Visible = True Else TextBox9.Visible = False
    End Sub

    Private Sub CheckBox9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox9.CheckedChanged
        If CheckBox9.Checked Then TextBox10.Visible = True Else TextBox10.Visible = False
    End Sub

    Private Sub CheckBox10_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox10.CheckedChanged
        If CheckBox10.Checked Then TextBox11.Visible = True Else TextBox11.Visible = False
    End Sub

    Private Sub CheckBox11_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox11.CheckedChanged
        If CheckBox11.Checked Then TextBox12.Visible = True Else TextBox12.Visible = False
    End Sub

    Private Sub CheckBox12_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox12.CheckedChanged
        If CheckBox12.Checked Then TextBox13.Visible = True Else TextBox13.Visible = False
    End Sub

    Private Sub CheckBox13_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox13.CheckedChanged
        If CheckBox13.Checked Then TextBox14.Visible = True Else TextBox14.Visible = False
    End Sub

    Private Sub CheckBox14_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox14.CheckedChanged
        If CheckBox14.Checked Then TextBox15.Visible = True Else TextBox15.Visible = False
    End Sub

    Private Sub CheckBox15_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox15.CheckedChanged
        If CheckBox15.Checked Then TextBox16.Visible = True Else TextBox16.Visible = False
    End Sub
    Dim mssg As String
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MessageBox.Show(mssg)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

hi, I'm having a problem in our case study how will I put all the values inside the message box? Once I click the button, the order must appear on the message box together with the costumer name which is written in a text box. So far this is what I've done. Sorry for the quality. My sister's laptop doesn't have editing software.

You have way to many event handlers...

Did you know you can share handlers?

Example:

Private Sub CheckChanged(sender as object, ByVal e As EventArgs) Handles CheckBox1.CheckChanged,CheckBox2.CheckChanged,CheckBox3.CheckChanged
   If Ctype(sender,CheckBox).Checked Then TextBox.Visible=True Else TextBox.Visiable = FALSE
End Sub

As for the mssg, are you pulling the value from the text box that is visible?

well simple use this.

msgbox(txtbox.text)

and if you have so many txtboxes and want to show the data in masg then you can use this.

msgbox("name:" & txtName.text & vbCrlf & "Age:" & txtAge.text)

hopr this will help you.
Regards.

Or even

TextBox.Visible = Ctype(sender,CheckBox).Checked
commented: Nice, I have never used that method. Good to see a shorter, more effecient way of doing it. +5
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.