title: I want to send data and receive data as string if possible or at least as integer
body: <ol>
  <li><p>I am trying to send and receive data through mscomm port, but am receiving datatype mismatch.so what should I do to avoid this error, I need to send data as integer and receive it as string if possible ,minimum I should get it as integer datatype. The following is my code, please help me to solve this problem.</p></li>
  <li><p>The send  and receive code is working when run independently. </p></li>
  </ol>
  
  
  
  <pre><code>Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  
  Private Sub Command1_Click()
      If (MSComm1.PortOpen = False) Then
          MSComm1.PortOpen = True
      End If
      Command1.Enabled = False
      Command2.Enabled = True
      Text3.Text = "COM1, Baud - 9600, Databit - 8, Parity - None, Stopbit - 1....CONNECTED." &amp; Text3.Text
  End Sub
  
  Private Sub Command2_Click()
      If (MSComm1.PortOpen = True) Then
          MSComm1.PortOpen = False
      End If
      Command1.Enabled = True
      Command2.Enabled = False
      Text3.Text = "DISCONNECTED" &amp; Text3.Text
  End Sub
  
  Private Sub Command3_Click()
      Text1.Text = " "
      Text2.Text = " "
      Text3.Text = "CLEARED" &amp; Text3.Text
  End Sub
  
  Private Sub Command4_Click()    
      MSComm1.Output = Text2.Text
      Text3.Text = "SENDING" &amp; Text3.Text
  End Sub
  
  Private Sub Command5_Click()
      Text3.Text = " "
  End Sub
  
  Private Sub Form_Load()
      MSComm1.CommPort = 1
      MSComm1.Settings = "9600,N,8,1"
      MSComm1.DTREnable = True
      MSComm1.Handshaking = comRTS
      MSComm1.InBufferSize = 2
      MSComm1.RThreshold = MSComm1.InBufferSize
      MSComm1.RTSEnable = True
      MSComm1.InputLen = 2
      MSComm1.InputMode = comInputModeText
      MSComm1.NullDiscard = True
      MSComm1.OutBufferSize = 2
      MSComm1.SThreshold = MSComm1.OutBufferSize    
      MSComm1.PortOpen = True  
  End Sub
  
  Private Sub Form_Unload(Cancel As Integer)
      If (MSComm1.PortOpen = True) Then
          MSComm1.PortOpen = False
      End If
  End Sub
  
  Private Sub MSComm1_OnComm()
      Dim Buffer As String
      Select Case MSComm1.CommEvent
          Case comEvReceive
              'Text1.Text = " "
              Buffer = Cstr(MSComm1.Input)
              Text1.Text = Buffer
      End Select
  End Sub
  </code></pre>