K
Keith
I'm trying to iterate through the controls on the form -
to find the control with "focus". Someone (Tim) referred
me to the code below - which is in C# I don't really
follow it - can someone lend a hand and convert it to
VB.NET. Thank you.
public virtual Control ActiveControl
{
get
{
return GetFocusedControl(this);
}
set
{
if (!value.Focused)
{
value.Focus();
}
}
}
private Control GetFocusedControl(Control parent)
{
if (parent.Focused)
{
return parent;
}
foreach (Control ctrl in parent.Controls)
{
Control temp = GetFocusedControl(ctrl);
if (temp != null)
{
return temp;
}
} return null;
}
to find the control with "focus". Someone (Tim) referred
me to the code below - which is in C# I don't really
follow it - can someone lend a hand and convert it to
VB.NET. Thank you.
public virtual Control ActiveControl
{
get
{
return GetFocusedControl(this);
}
set
{
if (!value.Focused)
{
value.Focus();
}
}
}
private Control GetFocusedControl(Control parent)
{
if (parent.Focused)
{
return parent;
}
foreach (Control ctrl in parent.Controls)
{
Control temp = GetFocusedControl(ctrl);
if (temp != null)
{
return temp;
}
} return null;
}