Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ANother beginner's question

Status
Not open for further replies.

polygong

Programmer
Joined
Feb 13, 2005
Messages
2
Location
CA
Hi everyone,

I'm pretty new to C++, though I have some VB experience, but I have a simple question (I'm using Visual Studio.NET BTW):

I have an integer variable whose value I want to place into a text box, but since the Text property is a string type I can't jsut place it there. How do I convert the integer to the right string type and place it into the textbox?

Side question: does anyone know if any good resources for learing C++ VS.NET? Espcially for using Windows forms? The documentation that comes with it seems more suited for more experienced programmers than me.
 
has a c++ package

you can try this int MyVar = 0 ;

cout <<"text"<< Myvar << endl;

or, if you already knew this you could aply (int) before the string , wich temp. force it to be an int value.

<<"text"<< (int)Myvar << endl;

i dont got the code so try this:
 
Code:
int iNum = 5;
char szNum[ 12 ];
itoa( iNum, szNum, 10 );
// Now put szNum in the text box.
 
you could use itoa to convert to a string or you can type cast....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top