What is the purpose of the tag property for this tutorial program?
In the beginners guide, Second program, it seems that btnSender.Tag is supposed to get the tag property of each button that is clicked. However, if I change the values of the tags of each button, nothing happens, and the program run as usual.
--------------------
code:
Sub btnEvent_Click
'We need to know what button raised the event.
'we use the Sender Object which Is a special Object that holds
'the Object reference of the View that generated the event In the event routine.
Dim btnSender AsButton
btnSender = Sender
Select btnSender.Tag
Case"BS"
IflblResult.Text.Length >0Then
lblResult.Text = lblResult.Text.SubString2(0,lblResult.Text.Length - 1)
' >> lblResult displays the user input, not the result
EndIf
CaseElse
lblResult.Text = lblResult.Text & btnSender.Text
'>> IMPORTANT
' >>display the value of the Button In the lblResult Label
' >> and pass it to the CheckResult sub.
EndSelect
IflblResult.Text.Length = 0Then
'When clicking on the BS button we must remove the last
'character from the existing text In lblResult
btn0.Visible = False
Else
btn0.Visible = True
EndIf
End Sub
In the beginners guide, Second program, it seems that btnSender.Tag is supposed to get the tag property of each button that is clicked. However, if I change the values of the tags of each button, nothing happens, and the program run as usual.
--------------------
code:
Sub btnEvent_Click
'We need to know what button raised the event.
'we use the Sender Object which Is a special Object that holds
'the Object reference of the View that generated the event In the event routine.
Dim btnSender AsButton
btnSender = Sender
Select btnSender.Tag
Case"BS"
IflblResult.Text.Length >0Then
lblResult.Text = lblResult.Text.SubString2(0,lblResult.Text.Length - 1)
' >> lblResult displays the user input, not the result
EndIf
CaseElse
lblResult.Text = lblResult.Text & btnSender.Text
'>> IMPORTANT
' >>display the value of the Button In the lblResult Label
' >> and pass it to the CheckResult sub.
EndSelect
IflblResult.Text.Length = 0Then
'When clicking on the BS button we must remove the last
'character from the existing text In lblResult
btn0.Visible = False
Else
btn0.Visible = True
EndIf
End Sub