You are trying to add an integer to a string (.Text) which will result in the runtime exception
Quote:
An unhandled exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll
Instead do something like this ...
First you need to get the current text of the label as an actual number - I've used a
Long
hoping that you get big scores :-)
I've used the
TryParse
method in case the label doesn't have any score in it yet
Once I get the number that is in there I add 10 to it
Then I assign the label text to that value converted to a string.
Dim i As Long
If Not Long.TryParse(Label2.Text, i) Then
i = 0
End If
i += 10
Label2.Text = i.ToString()