Converting textBox1 to a Character Type
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
The type textBox1->Text
is System::String ^
.
What do you mean by character type
?
A character type is a char or char32_t and wchar_t
textbox is a string
im basically saying how can i comvert a string to a character type
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.