title: 'Char' is not a member of 'String'" in VB.NET
body: <p>Scenario is described below:</p>
  
  <p>In txtDiscountRate.Text it has a value which is "0.996010500406591".</p>
  
  <p>In my coding I did this:</p>
  
  <pre><code>txtDiscountRate.Text = Math.Round(Val(txtDiscountRate.Text.Trim), 6)  'means considering round till 6th digit
  </code></pre>
  
  <p>It is giving the value 0.99601 because of 6th digit after decimal is 0. But I want to put a condition in the decimal value.</p>
  
  <p>So if on 6th digit after decimal is ( 0 or 1 or 2 or 3 or 4 ) and 7th digit after decimal is available, then it will round until 7th position. 
  Or else it will round until 6th position.</p>
  
  <p>I got a solution (shown in the code below) from this site for this problem. I tried to implement but the below code throws an error:</p>
  
  <pre><code>CInt(Str(1).Char(5))  is showing error this error  -&gt; " 'Char' is not a member of 'String'".
  </code></pre>
  
  <p>This is my whole code so far:</p>
  
  <pre><code>Dim str() As String = Split(CStr(Dec), ".")
  
  If CInt(Str(1).**Char(5)**) &lt; 5 Then 'It's Char number 5 since it's a zero-based index. So the first number = Index 0.
      txtDiscountRate.Text = Math.Round(Val(txtDiscountRate.Text.Trim), 7)
  Else
      txtDiscountRate.Text = Math.Round(Val(txtDiscountRate.Text.Trim), 6)
  End If
  </code></pre>
  
  <p><strong>Correct solution is needed.</strong></p>