Obada Saadeh Obada Saadeh - 2 months ago 12
C# Question

how to change the form properties in client-side using server-side C#

i have server-client application, i would like to change the properties of any object in client side form using the server for example:


button name is (button1) : maximize client's window

client side:

form name is: ClientForm

when i click on the button1 in hte server-side, it will maximize the form ClientForm in client-side

thank you in advance


Here is a very simple solution to get you rolling:

Create an event in the client's socket listener:

public event string MessageReceived;

When a new string comes through, do any processing that is necessary and then raise the event:

MessageReceived(this, "MaximizeWindow")

Then create a listener in your ClientForm

SocketListenerClassInstance.MessageReceived += OnMessageReceived;

and process those messages with a method in your ClientForm:

void OnMessageReceived(object sender, string msg)
    if (msg.Equals("MaximizeWindow")
        this.WindowState = FormWindowState.Maximized;