Converting textBox1->Text into a basic string.
How would I do this in Visual C++ 9?
Converting textBox1->Text into a basic string.How would I do this in Visual C++ 9?
Page 1 of 1
4 Replies - 6112 Views - Last Post: 09 June 2009 - 04:22 PM
Replies To: Converting textBox1->Text into a basic string.
#2
Re: Converting textBox1->Text into a basic string.
Posted 07 June 2009 - 09:10 AM
I'll presume that your text box is on a CDialog and it's control ID is IDC_EDIT1:
Is that what you were after?
TCHAR szBuf[256]; GetDlgItemText(IDC_EDIT1, szBuf, strlen(szBuf)); string sText(szBuf);
Is that what you were after?
#3
Re: Converting textBox1->Text into a basic string.
Posted 07 June 2009 - 09:15 AM
#4
Re: Converting textBox1->Text into a basic string.
Posted 07 June 2009 - 11:55 AM
What is that?
It dosn't even have "textBox1->Text" in it.
It dosn't even have "textBox1->Text" in it.
#5
Re: Converting textBox1->Text into a basic string.
Posted 09 June 2009 - 04:22 PM
azjherben, on 7 Jun, 2009 - 10:55 AM, said:
What is that?
It dosn't even have "textBox1->Text" in it.
It dosn't even have "textBox1->Text" in it.
Thats because you are doing a Forms application which is .NET, there showing you how to do it
in MFC, by the ID which is better. forms is quite lame and even lamer because you need the .NET framework.
But here you Go:
String* myStr = textBox1->text; // to string int myInt = Convert::toInt32(myStr); // to int
AndyH1963, on 7 Jun, 2009 - 08:10 AM, said:
I'll presume that your text box is on a CDialog and it's control ID is IDC_EDIT1:
Is that what you were after?
TCHAR szBuf[256]; GetDlgItemText(IDC_EDIT1, szBuf, strlen(szBuf)); string sText(szBuf);
Is that what you were after?
Why not make it simple? add a variable myTextBox;
CString str; myTextBox.GetWindowText(str);
This post has been edited by ImaSexy: 09 June 2009 - 04:22 PM
Page 1 of 1

New Topic/Question
Reply



MultiQuote



|