WindowsForm control as a parameter
c#, oop, parameters, winforms
Solution
Yes of course, it's absolutely possible... a control is an object like any other, so it can be passed as a parameter or stored in a variable
void SayHello(TextBox textBox)
{
textBox.Text = "Hello world";
}
...
SayHello(textBox1);
Problem
My question is simple. I have a method within a class and I want this method to change the text in a `TextBox`. The `TextBox` might change during runtime so I'm trying to find a way to pass the `TextBox` control as parameter when I call the method. Is this even possible ? Thanks in advance.