how to convert string to float
my code is
float dec2DivId;
if (ddllist.SelectedIndex == 1)
{
if (TextBox1.Text != string.Empty)
{
dec2DivId = Convert.ToString(TextBox1.Text).ToString();
{
if (TextBox1.Text != string.Empty)
{
dec2DivId = Convert.ToString(TextBox1.Text).ToString();


Abhay ShankerRank #375 · 6.7K reputationPosted Mar 30, 2014, 8:35 PM EDT
dec2DivId = Convert.ToDecimal(Convert.ToString(TextBox1.Text).ToString());
Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Mar 30, 2014, 8:51 PM EDT
Jignesh TrivediRank #16 · 50.3K reputationPosted Mar 31, 2014, 3:37 AM EDT
hi,
try below code if you want to avoid any conversion error.
string data = "10.23";
double dou;
double.TryParse(data, out dou);
hope this will help you.