How to convert from string to integer?

A

Allen Maki

I am working with MS Visual C++ .net 2003.

With your help, thank you, I am able to take data from the user through a
text box of a form and show the information on label of another form. But I
discovered that the data that I collected was not in such a format by which
I can do simple arithmetic operations on them. I want to be able to
manipulate the collected data arithmetically such as adding and multiplying
them. I would be please if someone can help converting this code in a way
that I can be able to manipulate the the collected data arithmetically. In
other words, I would like to have the date in int or double, instead of
string.



Below are snip shots of two classes. Form1 and ResultOut. From the first
class I show the event handler and from the second class I show the
property.





//Form1 :- Form1.h:



public __gc class Form1 : public System::Windows::Forms::Form

{

..

..

..

..



private: System::Void OKBtn_Click(System::Object * sender,
System::EventArgs * e)

{

//Create dialog

ResultOut* box = new ResultOut();



//Fill fill in data



box->Result = Form1::NumInBox->Text;



//Show dialog

if (box->ShowDialog() == DialogResult::OK)

{

box->Result; //get is used

}





};



//Form2:- ResultOut.h:



public __gc class ResultOut : public System::Windows::Forms::Form

{

..

..

..

..

..

..



public:

__property void set_Result(String* n){resultOutLbl->Text = n;}

__property String* get_Result(){return resultOutLbl->Text;}



};
 
A

Aidy

In which case, you're posting in the wrong group - this group is for C#...

Is it? I thought it was for asp.net ;)
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Allen said:
I am working with MS Visual C++ .net 2003.

With your help, thank you, I am able to take data from the user through a
text box of a form and show the information on label of another form. But I
discovered that the data that I collected was not in such a format by which
I can do simple arithmetic operations on them. I want to be able to
manipulate the collected data arithmetically such as adding and multiplying
them. I would be please if someone can help converting this code in a way
that I can be able to manipulate the the collected data arithmetically. In
other words, I would like to have the date in int or double, instead of
string.

The data types have Parse methods for parsing string data, like
Int32::parse and Double::parse.
 

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

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top