C
C# Learner
How can I achieve something like the following?
private void label_Click(object sender, System.EventArgs e)
{
Label label = (Label)sender;
int number = (int)label.Tag;
}
The second line causes a System.InvalidCastException to be thrown.
Nine Labels have their Click event handlers set to the above method.
Each has its Tag property set at design-time to a number from 0 to 8.
I've tried searching MSDN for info about the Tag property in
who-knows-what-base-class, but it's like trying to find a needle in a
haystack.
private void label_Click(object sender, System.EventArgs e)
{
Label label = (Label)sender;
int number = (int)label.Tag;
}
The second line causes a System.InvalidCastException to be thrown.
Nine Labels have their Click event handlers set to the above method.
Each has its Tag property set at design-time to a number from 0 to 8.
I've tried searching MSDN for info about the Tag property in
who-knows-what-base-class, but it's like trying to find a needle in a
haystack.