Create a public property of the type of the control you want to expose. In the case of exposing a control, you should use a readonly property as it's unlikely you'll ever want to support re-assigning the control.
Code:
public class MyForm : Form{
...
public TextBox UserNameControl{
get{ return txtUserName; }
}
...
}
Then you can use that control from outside the form:
Code:
MyForm myFormInstance = new MyForm();
myFormInstance.UserNameControl.Text = "name";
However, like I suggested before, it's better practice to expose just the properties of the control you need to expose instead of the control itself. This is safer and often easier from the perspective of the consuming code.
-
Peter
(Edit - Added formatting)