Click here to Skip to main content
15,894,907 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hey there , thanks for taking your time to read this , I am developing a game and ran into another problem , I am done with everything in my game but the level system. I did this code to make sure it doesn't crash when the progressbar goes over the maximum value:
VB
'Increases Level by every click slowly
        If Stats.ProgressBar1.Value = 100 Then MsgBox("You are ready to level up!") Else 
        If Stats.ProgressBar1.Value <= 100 Then Stats.ProgressBar1.Value = Stats.ProgressBar1.Value + 2
        If Stats.ProgressBar1.Value >= 100 Then Stats.ProgressBar1.Value = 100

But it just freezes up instead , Can someone please tell me how to do this or another way to do it? :)
Posted

1 solution

Try:
VB
If Stats.ProgressBar1.Value = 100 Then
   MsgBox("You are ready to level up!")
Else
   Stats.ProgressBar1.Value = Math.Min(100, Stats.ProgressBar1.Value + 2)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900