Upon checking the corresponding check box, which is either Ladies Shoes, Men Shoes, Sneakers or Sandals, the program needs fill the listbox with the checkbox information. Can't figure the syntax, any help would be greatly appreciated.

Public Class Form1

    Private Sub chkboxLadiesShoes_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkboxLadiesShoes.CheckedChanged
        Dim ladiesShoes As String = "Ladies Shoes"

        If chkboxLadiesShoes.CheckState = 1 Then
            lstDisplay.Text = ladiesShoes
        ElseIf chkboxLadiesShoes.CheckState = 2 Then
            lstDisplay.Items.Clear()

        End If
    End Sub

    Private Sub chkboxMenShoes_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkboxMenShoes.CheckedChanged
        Dim menShoes As String = "Men Shoes"
        If chkboxMenShoes.CheckState = 1 Then
            lstDisplay.Text = menShoes
        ElseIf chkboxMenShoes.CheckState = 2 Then
            lstDisplay.Items.Clear()

        End If
    End Sub
    Private Sub chkSneakers_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkboxSneakers.CheckedChanged
        Dim sneakers As String = "Sneakers"
        If chkboxSneakers.CheckState = 1 Then
            lstDisplay.Text = sneakers
        ElseIf chkboxSneakers.CheckState = 2 Then
            lstDisplay.Items.Clear()

        End If
    End Sub

    Private Sub chkSandals_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkboxSandals.CheckedChanged
        Dim Sandals As String = "Sandals"
        If chkboxSandals.CheckState = 1 Then
            lstDisplay.Text = Sandals
        ElseIf chkboxSandals.CheckState = 2 Then
            lstDisplay.Items.Clear()

        End If
    End Sub


    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub
End Class

Not clear...you want to add item into list when user checked it?

so this line is wrong "lstDisplay.Text"
change with lstDisplay.Items.Add(CurrentItem) ex: lstDisplay.Items.Add(ladiesShoes)

Thanks, that did it, there's only one more thing. When user unchecks each box the list box should clear, which should be lstDisplay.Items.Clear() which of course does not work, could it be my IF statements? Any insight?

Actually i didn't agree with your if statement :
If you want to know check box is checked or not then use Checked function :
Try this :

Private Sub chkboxLadiesShoes_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkboxLadiesShoes.CheckedChanged
        Dim ladiesShoes As String = "Ladies Shoes"

        If chkboxLadiesShoes.Checked = True Then
            lstDisplay.Items.Add(ladiesShoes)
        ElseIf chkboxLadiesShoes.Checked = False Then
            lstDisplay.Items.Clear()
        End If
End Sub
commented: a great help +2

great, thank you, works perfectly. Just shows how important syntax is. Thanks Again.

you're welcome :)

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.