L
lisa
This is incredibly frustrating.
I have a VB6 app at work that we're upgrading to .NET. In the VB6
code, I'm able to get a reference to txtText by using
frm.Controls(txtText). In ASP.NET, we have Page.FindControl(txtText).
But in WindowsForms, there doesn't seem to be any equivalent.
Now, the Form.Controls collection only takes a numeric index. It's a
big form, and I don't want to have to iterate through the entire
control collection for each item I'm trying to reference.
I've been over and over the MSDN documentation, and I can't find
anything that I can use to do this. Has this capability really been
left out of .NET forms? Or is it just hiding under a name I wouldn't
have guessed (like replacing Repaint with Invalidate)?
Even the CallByName method requires an actual reference to the control.
Does anyone know how to get a reference to a control based on the text
of the control's name?
Thanks,
Lisa
I have a VB6 app at work that we're upgrading to .NET. In the VB6
code, I'm able to get a reference to txtText by using
frm.Controls(txtText). In ASP.NET, we have Page.FindControl(txtText).
But in WindowsForms, there doesn't seem to be any equivalent.
Now, the Form.Controls collection only takes a numeric index. It's a
big form, and I don't want to have to iterate through the entire
control collection for each item I'm trying to reference.
I've been over and over the MSDN documentation, and I can't find
anything that I can use to do this. Has this capability really been
left out of .NET forms? Or is it just hiding under a name I wouldn't
have guessed (like replacing Repaint with Invalidate)?
Even the CallByName method requires an actual reference to the control.
Does anyone know how to get a reference to a control based on the text
of the control's name?
Thanks,
Lisa