title: How would you use trimstart in vb.net for the following?
body: <p>I am trying to remove the leading zeros/"0" to set a planes heading and pitch but how would I go about it? In the first few attempts I have converted the integer values to string values using the <code>CInt</code> function and converting it back to an integer however this just turn up errors. Can anybody help? thanks in advance. </p>
  
  <pre><code>     Dim pitchint As Integer
      pitchint = Pitch_txt.Text
      If pitchint &gt; 720 Then
          pitchint = pitchint - 720
          Pitch_txt.Text = pitchint
      Else
          If pitchint &gt; 360 Then
              pitchint = pitchint - 360
              Pitch_txt.Text = pitchint
          End If
      End If
  
      If Pitch_txt.Text.Length &lt;&gt; 0 Then
          If Pitchlbl.Text &lt;&gt; Pitch_txt.Text Then
              Pitchlbl.Text = Pitch_txt.Text
          End If
      End If
  </code></pre>
  
  <p>the following is what i would do if i wanted to put pitchint to a string then back to integer</p>
  
  <pre><code>Dim pitchint As String
      pitchint = Pitch_txt.Text
      pitchint = CInt(pitchint.TrimStart("0"))
      If pitchint &gt; 720 Then
          pitchint = pitchint - 720
          Pitch_txt.Text = pitchint
      Else
          If pitchint &gt; 360 Then
              pitchint = pitchint - 360
              Pitch_txt.Text = pitchint
          End If
      End If
  
      If Pitch_txt.Text.Length &lt;&gt; 0 Then
          If Pitchlbl.Text &lt;&gt; Pitch_txt.Text Then
              Pitchlbl.Text = Pitch_txt.Text
          End If
      End If
  </code></pre>
  
  <p>there are no errors as such other than the value returned in the textbox and label are the same ie if i enter 070 the value returned is 070 no change.</p>