Hello again. I am back with the problem of using booleans with command buttons. Any reasearch I've done for other methods to complete my memory game have been for Vb2005, VB.net, VB2010, etc. Where as I'm stuck with VB5 not Knowing what to do.
`PLEASE NOTE: boolFirst is declared and defined in Form_Load!` Public Sub cmd1_Click() Dim bool1 As Boolean cmd1.Caption = 1 If bool16 = True & boolFirst = True Then `If cmd16 has been clicked first` cmd1.Visible = False cmd16.Visible = False lbl1.Visible = True lbl16.Visible = True ElseIf bool16 = False & boolFirst = True Then `If any other button was clicked first` cmd1.Caption = "?" bool1 = False boolFirst = False Else `Any other scenario` bool1 = True boolFirst = True End If End Sub Public Sub cmd16_Click() Dim bool16 As Boolean cmd16.Caption = 1 If bool1 = True & boolFirst = True Then `If cmd1 has been clicked first` cmd1.Visible = False cmd16.Visible = False lbl1.Visible = True lbl16.Visible = True ElseIf bool1 = False & boolFirst = True Then `If any other button was clicked first` cmd16.Caption = "?" bool16 = False boolFirst = False Else `Any other scenario` bool16 = True boolFirst = True End If End Sub
When running this, If I click on cmd1 first, the caption changes to "1" as expected, and it seems to be working. However upon clicking cmd16, teh caption changes, like for cmd1, however the buttons do not go away. Additionally, If I click any other button first, (and therefore setting boolFirst to true, but not bool16) the caption for cmd1 is set to "1", but not immeadiatly set back to "?".
The (apparent) problem here is that the if statements are not doing what I want them to do. Apart from the caption changing, nothing appears to work. My guess here is that where my booleans are declared are the problem, however switching around their locations has not solved the problem. Another possibility is messy code, and due to me beign reletively new to VB, I would not be surprised. any solutions out there for me to try?