W
William Ryan
In a nutshell, I need to get the name of the object that was just pressed
(in this case, the object will be a radioButton). I want to write one
handler for all four radio buttons and branch off depending on which one was
clicked..I can get it to work if I take off Option Strict and use late
Binding...but rather program an abacus than turn off Option Strict... here's
my code
Private Sub optFullTime_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles optFullTime.CheckedChanged,
optContractor.CheckedChanged, optCurrent.CheckedChanged,
optFormerEmployees.CheckedChanged, optTemporary.CheckedChanged,
optPartTime.CheckedChanged
Select Case sender.GetType.Name ' Returns RadioButton
'If I turn off option strict I can use sender.Name and it works but I know
I'm overlooking something trivial. So what I need is to know the name of
the control that was pressed. What am I overlooking?
Case "optFullTime"
MessageBox.Show(e.GetType.Name)
Case "optPartTime"
MessageBox.Show(e.GetType.Name)
Case "optContractor"
MessageBox.Show(e.GetType.Name)
Case "optTemporary"
MessageBox.Show(e.GetType.Name)
End Select
(in this case, the object will be a radioButton). I want to write one
handler for all four radio buttons and branch off depending on which one was
clicked..I can get it to work if I take off Option Strict and use late
Binding...but rather program an abacus than turn off Option Strict... here's
my code
Private Sub optFullTime_CheckedChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles optFullTime.CheckedChanged,
optContractor.CheckedChanged, optCurrent.CheckedChanged,
optFormerEmployees.CheckedChanged, optTemporary.CheckedChanged,
optPartTime.CheckedChanged
Select Case sender.GetType.Name ' Returns RadioButton
'If I turn off option strict I can use sender.Name and it works but I know
I'm overlooking something trivial. So what I need is to know the name of
the control that was pressed. What am I overlooking?
Case "optFullTime"
MessageBox.Show(e.GetType.Name)
Case "optPartTime"
MessageBox.Show(e.GetType.Name)
Case "optContractor"
MessageBox.Show(e.GetType.Name)
Case "optTemporary"
MessageBox.Show(e.GetType.Name)
End Select