[RESOLVED] Option butten Enabling for a game.
Ok i have a selection of classes you can chose from threw option buttens. But i am trying to make it so that the stats that the system randomly generates determines what class you can be and if the stat dosent match up then the class is disabled. The problem is that the code only works half the time. Can someone tell me what about my code isnt working? Or maybe a new code that might work.
This is my code :
Private Sub CheckStats()
'Checks Int and dex for Mage"
If Integer.Parse(lblInt.Text) >= 19 And Integer.Parse(lblDex.Text) >= 16 Then
optMage.Enabled = True
ElseIf Integer.Parse(lblInt.Text) <= 18 And Integer.Parse(lblDex.Text) <= 15 Then
optMage.Enabled = False
End If
'Checks Str for Knight'
If lblStr.Text >= Int(18) Then
optKnight.Enabled = True
ElseIf (lblStr.Text) <= Int(17) Then
optKnight.Enabled = False
End If
'Checks Con for Knight'
If lblCon.Text >= Int(18) Then
optKnight.Enabled = True
ElseIf lblCon.Text <= Int(17) Then
optKnight.Enabled = False
End If
As you can see i have tryed it in 2 differnt ways but both ways give the same results.
I have CheckStats() on my form_load and Roller_click that way it checks them as the form loads and the butten is pushed so that no one can cheat and get a class without having the stats. But as i said it only works half the time. Ty for your help. If you have any questions on it feel free to ask i might not have explained it well enough.
Re: Option butten Enabling for a game.
I did an experiment with your code and made some changes. Im assuming is VB.Net you are using:
vb.net Code:
Private Sub CheckStats()
Dim Dexterity As Integer
Dim Intellect As Integer
Dexterity = Integer.Parse(lblDex.Text)
Intellect = Integer.Parse(lblInt.Text)
If Intellect >= 19 And Dexterity >= 16 Then
optMage.Enabled = True
Else
optMage.Enabled = False
End If
End Sub
Re: Option butten Enabling for a game.
Awsom bro as always your code works perfectly! True programming master!