Archived

This topic is now archived and is closed to further replies.

converting text to a string

This topic is 5112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok i want to convert the text in textBox6 to a string to use in this: WritePrivateProfileString("el33t", "textBox6", **text string goes here**, "C:el33t.ini"); all help appreciated, thanks alot!

Share this post


Link to post
Share on other sites
What are we talking about here? C++ (which I don't think it is) or VB6 (which would make more sense)?

EDIT: VB6? What you're getting is the value textBox6 written to the file? Then all you need to do is remove the quotes, this references the text property of the textbox.


SketchSoft OFFLINE | SketchNews OFFLINE | NewKlear Studios



[edited by - doodle_sketch on December 16, 2003 12:29:21 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
we are talking about C++ here, i need to convert the text in textBox6 to a string to use in this command

WritePrivateProfileString("el33t", "textBox6", **text string goes here**, "C:el33t.ini";

i get an error if i just put textBox6->Text in, the compiler error is this:

error C2664: ''WritePrivateProfileStringA'' : cannot convert parameter 3 from ''System::String __gc *'' to ''LPCSTR''
Cannot convert a managed type to an unmanaged type

all help appreciated, thanks

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
does anyone know how to do this conversion in C++? thanks.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
hey spearhawk i tried your suggestion but i get this compile error:

error C2064: term does not evaluate to a function taking 0 arguments

error C2228: left of ''.c_str'' must have class/struct/union type

could you help me out? thanks

Share this post


Link to post
Share on other sites
Use Marshal.StringToHGlobalAnsi to convert to an umanged string (lookup the SDK documentation for details). Do you really want to mix managed and unmanged C++?

Share this post


Link to post
Share on other sites
"anonymous poster" I am having the EXACT same problem as you. I am making a form and trying to get TextBox->Text to a string. So far unsuccessful. TextBox->Text is an unmanaged string? Well... still there has to be some way to get what the user has typed in TextBox->Text into a string. Am I right in thinking this?

Convert TextBox->Text to string... randomstring

cout << randomstring;

Share this post


Link to post
Share on other sites