I did the first calculator tutorial with no problems. On the second one, it's throwing a java runtime error on this section of code:
The line lblNumber1.Text = Number1 gives the error "Object should first be initialized (Label). My code matches that in the tutorial exactly. Any ideas what could be causing this error?
UPDATE: I matched my code against the code in the source files and they're exactly the same except for two lines that are not included in the tutorial but wouldn't be the cause of this error message. Anyway, after adding the two lines, the code matches exactly, yet the source code version runs smoothly and my version throws the error message I mentioned above. How can this be?
B4X:
Sub New
Number1 = Rnd(1, 10)
Number2 = Rnd(1, 10)
lblNumber1.Text = Number1
lblNumber2.Text = Number2
lblComments.Text = "Enter the result" & CRLF & "and click on OK"
lblComments.Color = Colors.RGB(128,128,255)
lblResult.Text = ""
btn0.Visible = False
End Sub
The line lblNumber1.Text = Number1 gives the error "Object should first be initialized (Label). My code matches that in the tutorial exactly. Any ideas what could be causing this error?
UPDATE: I matched my code against the code in the source files and they're exactly the same except for two lines that are not included in the tutorial but wouldn't be the cause of this error message. Anyway, after adding the two lines, the code matches exactly, yet the source code version runs smoothly and my version throws the error message I mentioned above. How can this be?
Last edited: