private void ClearCommandText(TextBox control, string response)
 {
     if (txtResponse.InvokeRequired)
     {
         AddTextToTextbox c = ClearCommandText;
         Invoke(c, control, response);
     }
     else
     {
         control.Text = string.Empty;
     }
 }
 private void SetTextboxText(TextBox control, string text)
 {
     if (control.InvokeRequired)
     {
         AddTextToTextbox c = SetTextboxText;
         Invoke(c, control, text);
     }
     else
     {
         control.Text = text;
     }
 }
 private void ClearCommandText(TextBox control, string response)
 {
     if (txtResponse.InvokeRequired)
     {
         AddTextToTextbox c = new AddTextToTextbox(ClearCommandText);
         this.Invoke(c, new object[] { control, response });
     }
     else
     {
         control.Text = string.Empty;
     }
 }
 private void SetTextboxText(TextBox control, string text)
 {
     if (control.InvokeRequired)
     {
         AddTextToTextbox c = new AddTextToTextbox(SetTextboxText);
         this.Invoke(c, new object[] { control, text });
     }
     else
     {
         control.Text = text;
     }
 }
 private void AddServerResponseText(TextBox control, string response)
 {
     if (txtResponse.InvokeRequired)
     {
         AddTextToTextbox c = new AddTextToTextbox(AddServerResponseText);
         this.Invoke(c, new object[] { control, response });
     }
     else
     {
         if (control.Text.Length > 0)
         {
             control.Text += Environment.NewLine + Environment.NewLine;
         }
         control.Text += response;
     }
 }
 private void AddServerResponseText(TextBox control, string response)
 {
     if (txtResponse.InvokeRequired)
     {
         AddTextToTextbox c = AddServerResponseText;
         Invoke(c, control, response);
     }
     else
     {
         // substitute \r\n for \n
         if (!string.IsNullOrWhiteSpace(response))
         {
             response = response.Replace("\n", Environment.NewLine);
         }
         if (control.Text.Length > 0)
         {
             control.Text += Environment.NewLine + Environment.NewLine;
         }
         control.Text += response;
     }
 }