-
February 10th, 2011, 03:23 PM
#1
Hot to get text from textbox
Hi,
I've been using the following to set text in the textbox:
this->textBox_PaymentDue->Text = "$50";
but now I want to retrieve text from the text box.
I've tried:
string str;
str=this->textBox_PaymentDue->Text;
but this doesn't work. What am I doing wrong?
Thanks,
-
February 10th, 2011, 03:32 PM
#2
Re: Hot to get text from textbox
That doesn't look like any kind of VC++ code I've ever seen. What is textBox_PaymentDue?
-
February 10th, 2011, 03:35 PM
#3
Re: Hot to get text from textbox
Originally Posted by GCDEF
That doesn't look like any kind of VC++ code I've ever seen. What is textBox_PaymentDue?
"textBox_PaymentDue" is just the name that I gave to the
System.Windows.Forms.Textbox
as opposed to using the default "textBox1"
-
February 10th, 2011, 03:48 PM
#4
Re: Hot to get text from textbox
Originally Posted by vc_user
"textBox_PaymentDue" is just the name that I gave to the
System.Windows.Forms.Textbox
as opposed to using the default "textBox1"
You want to be one of the .net forums.
-
February 10th, 2011, 03:56 PM
#5
Re: Hot to get text from textbox
Do you know if VC++ 2010 or 2008 express allows you to make a non net Windows Gui application? It looks like that's the only option.
Maybe standard edition does?
-
February 10th, 2011, 07:06 PM
#6
Re: Hot to get text from textbox
You can make non-.NET GUI apps with the Express Edition, you'd just need to create a Win32 project (not a Win32 Console project) instead of a Windows Forms project. But that would be a really tough endeavour because you would need to work with raw Win32 API. The Express Edition doesn't feature any framework like MFC to support you in this, not even a resource editor.
There is no such thing as a Standard Edition (see http://msdn.microsoft.com/en-us/library/hs24szh9.aspx). The least you would need to conveniently develop Win32 GUI apps would be the Professional Edition, and unfortunately this isn't really cheap. Or you are lucky to fulfill the prerequisites to get a student edition which AFAIK would be free (see http://www.dreamspark.com).
But if you are writing .NET apps you should consequently stay inside the .NET world while doing so unless there's a real need to cross the border. E.g. you should use System::String instead of std::string unlike your code snippet from the OP.
And, well, there's still the option to use one of the non-MS frameworks like Qt. Some of them would even allow you to do cross-platform development. But of course I don't know whether this path really is an option for you.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
February 11th, 2011, 11:31 AM
#7
Re: Hot to get text from textbox
You don't say what kind of project it is, but try using UpdateData(FALSE) after writing to the control, and UpdateData(TRUE) before reading it back. At least, that's how I do it with Dialog based apps.
-
February 11th, 2011, 11:46 AM
#8
Re: Hot to get text from textbox
Originally Posted by Dave C
You don't say what kind of project it is, but try using UpdateData(FALSE) after writing to the control, and UpdateData(TRUE) before reading it back. At least, that's how I do it with Dialog based apps.
He's writing a .net app, not MFC with DDX.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|