title: type ussd command and display result in textbox using c#
body: <p>I have a Windows Form in my project. This form contains 3 controls: <code>txtUss</code>, <code>btnCheck</code> and <code>txtMessage</code>. The scenario is that after a "ussd" command has been entered in the  <code>txtUss</code> text box and the <code>btnCheck</code> button has been pressed, the result will displayed in <code>txtMessage</code>.</p>
  
  <p>here is the detail of my winform 
  <a href="https://www.dropbox.com/s/2lo8ci3rcoznvlh/ussd.PNG" rel="nofollow noreferrer">https://www.dropbox.com/s/2lo8ci3rcoznvlh/ussd.PNG</a></p>
  
  <p>btnCheck Code :</p>
  
  <pre><code>private void btnCheck_Click(object sender, EventArgs e)
  {
      try
      {
          SerialPort port = new SerialPort();
  
          port.BaudRate = 115200;
          port.PortName = "COM3";
          port.Timeout = 300;
  
          port.Open();
          port.Write("AT+CUSD=1," + txtUssd.Text + ",15");
  
          txtMessage.text = ; // &lt;&lt;&lt; here is the result. 
          // but i dont know how to refer port.Write("AT+CUSD=1," + txtUssd.Text + ",15");
          port.Close();               
      }
      catch (Exception ex)
      {
          MessageBox.Show(ex.Message);
      }
  }
  </code></pre>
  
  <p>I don't know how to get the result in the <code>txtMessage</code> text box.</p>
  
  <p>Any one can suggest me or give some example...?</p>
  
  <p><strong>if you wanna get update solve for this question and topic checking balance in modem, follow this link :</strong> 
  <a href="https://stackoverflow.com/questions/31677028/check-balance-using-ussd-command-in-c-sharp-solved">Check balance using USSD Command in C#</a></p>