Converting textBox1 to a Character Type

Mar 10, 2016 at 2:59am
How can I convert a textBox to a character type?
I know how to convert it to an int which is:
 
  Convert::ToInt32(textBox1->Text);

example of a character type is char32_t and wchar_t
I am using C++/Cli
Mar 10, 2016 at 11:14am
The type textBox1->Text is System::String ^.
What do you mean by character type?
Mar 11, 2016 at 7:10am
A character type is a char or char32_t and wchar_t
Mar 11, 2016 at 7:16am
textbox is a string
im basically saying how can i comvert a string to a character type
Mar 11, 2016 at 8:33am
Are you asking how to convert to c++ std::string?

if so you need marshal_as<std::wstring>:

https://msdn.microsoft.com/en-us/library/bb384859.aspx

1
2
3
4
5
6
#include <msclr/marshal.h>
#include <msclr/marshal_cppstd.h>

...

wstring str = msclr::interop::marshal_as<std::wstring>(textBox1->Text);
Topic archived. No new replies allowed.