F
Fritz Switzer
I'm trying to AppendText to a TextEdit. I have a procedure that will
go through the controls on a Windows form and return the control that has
"focus".
I have a number of TextEdits on my form and don't know which control
has focus.
I then want to paste text from the ClipBoard to this TextEdit control.
The following code is what I'm using. Everything works fine, it identifies
the correct control,
however, in a previous version I had this narly switch/case process and
would AppendText to
hard coded TextBox1.AppendText for example. Now that I just get back the
Control.Name,
I can figure out how to AppendText when I get back the Control object.
object o;
o = Clipboard.GetDataObject().GetData("Text");
if (o != null)
{
if (o.GetType().ToString() == "System.String")
TextEdit1.AppendText((string)o);
}
How do I modify the above code to use the returned Control Name instead of
the actual "TextEdit1.AppendText" ?
TIA,
go through the controls on a Windows form and return the control that has
"focus".
I have a number of TextEdits on my form and don't know which control
has focus.
I then want to paste text from the ClipBoard to this TextEdit control.
The following code is what I'm using. Everything works fine, it identifies
the correct control,
however, in a previous version I had this narly switch/case process and
would AppendText to
hard coded TextBox1.AppendText for example. Now that I just get back the
Control.Name,
I can figure out how to AppendText when I get back the Control object.
object o;
o = Clipboard.GetDataObject().GetData("Text");
if (o != null)
{
if (o.GetType().ToString() == "System.String")
TextEdit1.AppendText((string)o);
}
How do I modify the above code to use the returned Control Name instead of
the actual "TextEdit1.AppendText" ?
TIA,