foreach (var t in Grid1.Children)
{
if (t is Label)
{
string val = ((Label)t).Content.ToString()
}
}
Get the value of a Label from a general item
Question
I have a grid with labels and text boxes.
I want to get the content of the label.
Very easy if you know it is a label.
But this is what I have:
foreach (var t in Grid1.Children)
{
if (t.GetType() == typeof(Label))
{
string val = t.????;
}
}
How do I get the content of this label?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow