When dropping a control on a form, by default the control is private to the form. You can select a control, select properties, select the modifier property and set the value to public which allows you to access the control outside of the form. This technique is usually frown on.
If the control in question is on the form, not in another control like a panel you can use in another form or class.
if (Application.OpenForms[nameof(Form1)].Controls["textBox1"] is not TextBox textBox) return;
textBox.Text = "Hello";
textBox.BackColor = Color.Yellow;
And if the control is in a panel for instance. Add the following class to your project.
public static class ControlExtensions
{
public static IEnumerable<T> Descendants<T>(this Control control) where T : class
{
foreach (Control child in control.Controls)
{
if (child is T thisControl)
{
yield return (T)thisControl;
}
if (child.HasChildren)
{
foreach (T descendant in Descendants<T>(child))
{
yield return descendant;
}
}
}
}
}
Usage from a class or other form.
var tb = ((Form1)Application.OpenForms[nameof(Form1)])
.Descendants<TextBox>()
.FirstOrDefault(x => x.Name == "textBox1"); ;
if (tb is null) return;
tb.Text = "Hello";
tb.BackColor = Color.Yellow;