arazzy
arazzy

Reputation: 515

Updating a textbox on a WinForm from another class

I have a Windows Form called frmBatch.cs. It's the user interface I'm using for my project. In the code, I have a Server object (which I defined in another class).

Inside my Server object, I have a function where I add a batch to a batch server. During this process, I would like to update a status TextBox on frmBatch.cs to indicate which batch is currently being added.

How would I do this? I'm guessing I need to create a reference to the form in my Server object but I'm not sure of the best way to go about this.

Upvotes: 0

Views: 232

Answers (1)

PMF
PMF

Reputation: 17185

There are many different ways of achieving this, but a straight forward solution is to use an event. Create an event on the server side and register your form to it. Then you can fire the event whenever the data in the form needs to be updated.

Upvotes: 2

Related Questions