I am working on `c# winforms`. I have a `rich textbox` in my `main form`. Now I am using a class `HandleClient` in which I am using a thread in which I am calling a function. In that function, I have made a new object of my main form. My code is below

**Flow**

First of all, I am passing a port number via user and on button click, I am going to listen to it. For that, I have a class named `Server`

**Main Form**

```
port = Convert.ToInt32(tbPort.Text);
Server server = new Server(port);
if (btnListen.Text == "Listen")
{
     btnListen.Text = "Close";
     server.start();
}

```

The above object is created and the start method is called

**Server Class**

```
public Server(int port)
{
   this.port = port;
}

 public void start()
 {
        listner = new TcpListener(new IPEndPoint(IPAddress.Any, port));
        listner.Start();
        listnerthread = new Thread(new ThreadStart(Listner));
        listnerthread.Start();
 }

public void Listner()
{
        while (true)
        {
            try
            {

                TcpClient C = listner.AcceptTcpClient();
                HandleClient client = new HandleClient();
                client.startClient(C);

            }
            catch (Exception ex)
            {
                Console.WriteLine("Error in listner");
                Console.WriteLine(ex.Message);
            }
        }
}

```

The above method is listening to the port. Also, my handle client function is also called. In which I am trying to display the incoming string to the rich text box

**Handle Client**

```
 // Buffer to store the response bytes.
byte[] data = new byte[9999];

Thread comThread;
public void startClient(TcpClient inClientSocket)
{
   this.clientsocket = inClientSocket;
   comThread = new Thread(doChat);
   comThread.Start();
}

private void doChat()
{
        MainForm form = new MainForm();

        while ((true))
        {
            try
            {
                // Read the first batch of the TcpServer response bytes.
                NetworkStream stream = clientsocket.GetStream();
                stream.ReadTimeout = 1000;
                int bytes = stream.Read(data, 0, data.Length);                 

                responseData = BitConverter.ToString(data,0,bytes); 
                form.rtBRecievedData.Text = responseData;

                stream.Close();
                clientsocket.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(" >> " + ex.ToString());
                comThread.Abort();
            }
        }
}

```

The value of `responseData` is `01-01-01-01-00-01-00-19-F4-09-10-00-00-00-00-30-30-32-39-39-38-30-30-35-35-36-31-00-01-00-01-00-01-00-15-AA-10-00-00-00-00-30-30-32-39-39-38-30-30-35-35-36-31-12-00-12`

Now the main issue is that this string is not displaying on `rich text box`. I might be missing something that I am not able to understand. 

Any help would be highly appreciated.