there are some buttons that will be displayed when the form load. when the user first click on the first button, the invisible button that are put behind the first button will be displayed. whereas, when the user click second time on the 1st button, the dispayed button should be invisible again.
i have tried the select case, but it doesnt work.

Private Sub btnInTr_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInTr.Click
If count <= 2 Then
Select Case count
Case 0
btnInTr.Visible = True
btnInRe.Visible = True
btnGR.Visible = False
btnGI.Visible = False
Case 1
btnGR.Visible = True
btnGI.Visible = True
btnInRe.Visible = False
Case 2
btnGR.Visible = False
btnGI.Visible = False
btnInRe.Visible = True
End Select
count += 1
End If
End Sub

Recommended Answers

All 4 Replies

I tried your code and it works for me unless you are looking for something different. I get this:
First Click:
btnInRe visible
Second Click:
btnInRe not visible
btnGR and btnGl are visible
Third Click:
btnInRe visible
btnGR and btnGl are not visible
Did you want something different?

i know it works after the third click, but when i click (fourth click) again on the btnInTr,the hide buttons should be displayed. my problem is, it only works for 1st click, 2nd click and 3rd click only, if i want to repeat clicking on the btnInTr, it doesnt work anymore.

Try this:

Dim count As Integer = 0

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        btnInTr.Visible = True
        btnInRe.Visible = True
        btnGR.Visible = False
        btnGI.Visible = False
    End Sub

    Private Sub btnInTr_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInTr.Click
        Select Case (count Mod 2)
            Case 0
                btnGR.Visible = True
                btnGI.Visible = True
                btnInRe.Visible = False
            Case 1
                btnGR.Visible = False
                btnGI.Visible = False
                btnInRe.Visible = True
        End Select
        count += 1
    End Sub

thanks a lot waynespangler!!!it works!

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.