C # WinForms - How do I retrieve data from a text box on a form via another form?


I have a method that executes inside one form, but I need to retrieve data from another form to pass into the method.

Whats the best way of doing this?

Assuming that formB is initialized in formA I would recommend adding a string to the constructor of formB sending the Texbox1.Text

as in

class formB: Form{
   private string data;
   public formB(string data)
        this.data = data;
  //rest of your code for the class