[Archive] [C#] How do i convert from a string to double? [Resolved]
[Archive] [C#] How do i convert from a string to double? [Resolved]
Archived author: dashker • Posted: 2016-06-01T00:12:58+00:00
Original source
Like i said from example
in TextBox1.text I have 2.0
How i can got this value?
Archived author: noc • Posted: 2016-06-01T04:57:43+00:00
Original source
like this ?
Int_Seconds = int.Parse(TextBox1.Text);
Quote: 5 minutes ago, noc said:1. This is int, not double.
like this ?
Int_Seconds = int.Parse(TextBox1.Text);
Archived author: Kaev • Posted: 2016-06-01T05:02:33+00:00
Original source
Quote: 5 minutes ago, noc said:1. This is int, not double.
like this ?
Int_Seconds = int.Parse(TextBox1.Text);
Archived author: noc • Posted: 2016-06-01T08:53:28+00:00
Original source
Thank Kaev, you're right.
I found some informations here : http://stackoverflow.com/questions/13549...o-a-double
and here : http://stackoverflow.com/questions/43528...-to-double
Archived author: dashker • Posted: 2016-06-01T09:33:36+00:00
Original source
So i will show you the problem, i am parsing a double, converting to string bubt with the double format
double text = double.Parse(ScaleBox.Text, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo);
string result = number[0] + "," + number[1]+ "," + number[2] + "," + number[3] + "," + text;
Quote: 50 minutes ago, dashker said:Does it work as you wanted or not? You just posted a snippet without any informations.
So i will show you the problem, i am parsing a double, converting to string bubt with the double format
double text = double.Parse(ScaleBox.Text, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo);
string result = number[0] + "," + number[1]+ "," + number[2] + "," + number[3] + "," + text;
Archived author: Kaev • Posted: 2016-06-01T10:25:56+00:00
Original source
Quote: 50 minutes ago, dashker said:Does it work as you wanted or not? You just posted a snippet without any informations.
So i will show you the problem, i am parsing a double, converting to string bubt with the double format
double text = double.Parse(ScaleBox.Text, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo);
string result = number[0] + "," + number[1]+ "," + number[2] + "," + number[3] + "," + text;
Quote: 2 hours ago, Kaev1695989297 said:Tes i have it hahaha but when i put it in a text box for example the "2.0" is 2 so i don't know if i have to add it into the string or another thing
Does it work as you wanted or not? You just posted a snippet without any informations.
Also, just for future coding style: If number[] is a array of int or double or smth like that, make sure to write number[0].ToString().
Archived author: dashker • Posted: 2016-06-01T12:41:40+00:00
Original source
Quote: 2 hours ago, Kaev1695989297 said:Tes i have it hahaha but when i put it in a text box for example the "2.0" is 2 so i don't know if i have to add it into the string or another thing
Does it work as you wanted or not? You just posted a snippet without any informations.
Also, just for future coding style: If number[] is a array of int or double or smth like that, make sure to write number[0].ToString().
Archived author: dashker • Posted: 2016-06-01T12:46:50+00:00
Original source
int[] number = new int[15];
number[0] = int.Parse(EntryBox.Text);
number[1] = int.Parse(ModelBox.Text);
number[2] = int.Parse(SoundBox.Text);
number[3] = int.Parse(DisplayInfoExtraBox.Text);
double scale = double.Parse(ScaleBox.Text, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo);
string result = number[0] + "," + number[1]+ "," + number[2] + "," + number[3] + "," + scale;
ShitBox.Text = result;
So i don't know how to handle the double so my head is exploding
Archived author: dashker • Posted: 2016-06-02T15:00:29+00:00
Original source
Anyone Help me please?
Thanks for answers
Archived author: Skarn • Posted: 2016-06-02T15:17:19+00:00
Original source
Isn't there a way to make a TextField return a double or a float without any conversion?