1
Answer

Excel Spreadsheet like Control

Administrator

Administrator

22y
1.8k
1
Does anyone know of any Excel Spreadsheet like control available for application design with C#? Preferably free ones, but if all that's out there are comercial version you need to buy, so be it and mentionned then anyways. Thanks
Answers (1)
0
Nilanka Dharmadasa
NA 5.2k 0 15y

Hi Friend,
In previous reply, one part is missing. I think this reply will be more helpful to you.
 
private void button1_Click(object sender, EventArgs e)
{

string cookie = "1234.6";
int intcookie = 0;
int result;
double result2;
if (Int32.TryParse(cookie, out result))
{

intcookie = result;

}
else if (Double.TryParse(cookie, out result2))
{

intcookie = (
int)result2;

}
else
{


MessageBox.Show("Cookie is not a number.");

}

}

Please mark Do you like this answer checkbox, if this helps you.
0
Nilanka Dharmadasa
NA 5.2k 0 15y

Friend,
Use following code.
 
private void button1_Click(object sender, EventArgs e)
{

string cookie = "1234";
int intcookie = 0;
int result;
if (Int32.TryParse(cookie, out result))
{

intcookie =
Int32.Parse(cookie);

}
else
{

MessageBox.Show("Cookie is not a number.");

}

}
 
Please mark Do you like this answer checkbox, if this helps you.
0
shyamala
NA 96 0 15y
Hi home base......

thanks for ur reply..but it created error in int32.parse(2nd line)..the error is input string was not in a correct format
0
Lalit M
NA 6.7k 48k 15y

You can use the Convert class or the Parse method of the built-in type you are casting to.  i.e.

    string myStr = "123";
    int myParsedInt = Int32.Parse(myStr);
    int myConvertedInt = Convert.ToInt32(myStr);


This example uses the int type, but you can also use the same techniques for any of the other integral or floating point types.