Button initialization


Licensed User
Am getting a runtime error: btnSender (Button) Not initialized, for the below code.
FYI, this is the exact piece of code from the 'Beginners Guide'.

Sub btnEvent_Click
Dim btnSender As Button
btnSender = Sender

Select btnSender.Text
Case "BS"
If lblResult.Text.Length > 0 Then
lblResult.Text = lblResult.Text.SubString2(0, lblResult.Text.Length - 1)
End If
Case Else
lblResult.Text = lblResult.Text & btnSender.Text
End Select

Could you please help! thanks!


Licensed User
Dim btnSend As Button
btnSend = Sender

What version of B4A are you using?
In mine, V 2.7.1 although it is not initialize it did not give the error message and it run ok. But I think for consistency is it should be initialized.
Hi @Erel what is your opinion? It is the SecondProgram from the Beginners Guide.