Reputation: 521
I'm working on winforms VC++.
I got selected item of combobox by:
String ^getSelectedFromCmbobox(){
String ^selected = this->combobox->SelectedItem->ToString();
return selected;
}
in MyForm.h file. I want to get seleceted item's name and concat it with another string("\\.\"), and use it as a char *
parameter.
How can I do that?
Since it contains ^ sign it's hard to search in Google, excuse me if it is duplicate.
Upvotes: 0
Views: 246
Reputation: 1082
best way will be to use StringToHGlobalAnsi
wich copies the contents of a managed String into unmanaged memory. Here the msdn link : http://msdn.microsoft.com/en-en/library/system.runtime.interopservices.marshal.stringtohglobalansi(v=vs.110).aspx.
Alsom, you have .Net method String::Concat for concatenate String objects.
Upvotes: 1