title: Casting DataRow value into float
body: <p>I'm working with <code>DataRow</code> and I want to divide every value in the row with a number(taken from a cell from the same row). I've been searching ways to convert the values into float, like from <a href="https://stackoverflow.com/questions/17719016/parsing-int-from-datarow-cell">this</a> thread, but casting gives me "Specified cast is not valid" error.</p>
  
  <pre><code>List&lt;DataTable&gt; tblsol = new List&lt;DataTable&gt;();
  DataTable now = tblsol.Last();
  
  while (true)
          {
              DataRow fb = now.Rows[v];
              DataRow fb2 = now.Rows[w];
              float akun = (float)fb[fb.Table.Columns.Count - 1] /
              (float)fb[u];
              if (akun &gt; (float)fb2[fb2.Table.Columns.Count - 1] /
              (float)fb2[u])
              {
                  if (w == now.Rows.Count - 1) { v = w; break; }
                  else { v++; w++; }
              }
              else 
              {
                  if (w == now.Rows.Count - 1) { break; }
                  else { w++; }
  
              }
          }
  
          DataRow bk = now.Rows[v];
  
          float angkun = Convert.ToSingle(bk[u]);
          for (int dc = 1; dc &lt; now.Columns.Count;dc++)
          {
              bk[dc] = Convert.ToSingle(bk[dc]) / angkun;
          }
  </code></pre>
  
  <p>I used 2 methods to convert the value into float (using <code>Convert.toSingle</code> and casting), but both ways gave me error. Is there anything else I can do? Or maybe is there something wrong in my code?<br>
  p.s. <code>tblSol</code> is not empty and all variables are already declared.</p>