Very stupid newbie question

G

Guest

How do I get a string representation of a number in a textbox into a double
precision variable.

Have tried hundeds like:

double F = (textBox1->Text->ToDouble);
 
B

Brian Muth

mark said:
How do I get a string representation of a number in a textbox into a
double
precision variable.

Have tried hundeds like:

double F = (textBox1->Text->ToDouble);

Checkout Double.Parse(string s)

Brian
 
N

Nathan Mates

How do I get a string representation of a number in a textbox into a double
precision variable.

When the new and fancy falls on its face, fall back to good
old-fashioned but still functional K&R? MS keeps trying to reinvent
the wheel, but at least they still let people bypass them. See
http://msdn2.microsoft.com/en-us/library/zkx076cy(vs.80).aspx or
http://msdn2.microsoft.com/en-us/library/t6z7bya3(VS.80).aspx .
Basically, in C/C++, you can do:

double v;
const char* pStr = GetTextbox();
sscanf(pStr, "%lf", &v); // or sscanf_s, or swscanf if widechars

Nathan Mates
 
G

Guest

OK, I have:

private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) {
Double.Parse(textBox1->Text);
}

I get debug error C2143 missing ';' before '.'
 
G

Guest

Is there something I should be certain I am including or using here to be
able to access the more friendly functionality?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top