T
Tetsuya Oguma
Hi all,
I just started coding C# migrating from VB/VBA and stumbled at this one.
A fired up KeyUp event of a control calls the below with the same "object
sender" parameter.
This "object sender" could be either TextBox or ComboBox. How can I get to
their Tag property that stores either *true* or *false*? I try to cast sender
but in vain...
private List<string> CoarseSourceToTickers(object sender, bool
isMarket1)
{
object control;
if (sender is BlpTextBox)
{
BlpTextBox control = (BlpTextBox)sender;
isMarket1 = System.Convert.ToBoolean(control.Tag);
}
else
{
BlpComboBox control = (BlpComboBox)sender;
isMarket1 = System.Convert.ToBoolean(control.Tag);
}
This gives me an error of "Error 1 A local variable named 'control' cannot
be declared in this scope because it would give a different meaning to
'control', which is already used in a 'parent or current' scope to denote
something else" with a wavy blue underline under the word, control in
"BlpTextBox control = (BlpTextBox)sender;"
Thanks!
I just started coding C# migrating from VB/VBA and stumbled at this one.
A fired up KeyUp event of a control calls the below with the same "object
sender" parameter.
This "object sender" could be either TextBox or ComboBox. How can I get to
their Tag property that stores either *true* or *false*? I try to cast sender
but in vain...
private List<string> CoarseSourceToTickers(object sender, bool
isMarket1)
{
object control;
if (sender is BlpTextBox)
{
BlpTextBox control = (BlpTextBox)sender;
isMarket1 = System.Convert.ToBoolean(control.Tag);
}
else
{
BlpComboBox control = (BlpComboBox)sender;
isMarket1 = System.Convert.ToBoolean(control.Tag);
}
This gives me an error of "Error 1 A local variable named 'control' cannot
be declared in this scope because it would give a different meaning to
'control', which is already used in a 'parent or current' scope to denote
something else" with a wavy blue underline under the word, control in
"BlpTextBox control = (BlpTextBox)sender;"
Thanks!