title: System.FormatException Input string was not in a correct format error in Console Application C#?
body: <p>i am getting the Error When the value of <strong>row[colname]="NULL" and "ABC"</strong> is there any way to avoid it !!<br/> <strong>i even try to Try parse but i am getting error cannot convert object to string in</strong> <code>row[colname]</code>(commented the code)
  <a href="https://i.stack.imgur.com/4dyDI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4dyDI.jpg" alt="error cannot convert object to string in row[colname]"></a></p>
  
  <p>An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll</p>
  
  <pre><code>foreach (DataRow row in csvData.Rows)
              {
                  //var Result = double.TryParse(row[colname], out myDec);
  
                  if (Convert.ToDouble(row[colname]) &gt;= med1 &amp;&amp; Convert.ToDouble(row[colname]) &lt;= med2)
                  {
                      al.Add(Convert.ToDouble(row[colname]));
                      //Console.WriteLine("value greater than 20 % median= {0}", Convert.ToDouble(row["Data Value"]));
                  }
  </code></pre>