![]() |
| ||
| string to int Does anyone know how to convert a "String^" data type in a visual studio 2005 forms app to an "int"? Ive tried atoi and casting to no success. Any ideas? Thanks. |
| ||
| Re: string to int try Int32::Parse(stringname) |
| ||
| Re: string to int C++/CLI handles boxing and unboxing implicitly. Either of these work just peachy: using namespace System; using namespace System; |
| ||
| Re: string to int [edit] misread the OP |
| ||
| Re: string to int Thanks, but new issue. String^ comPort = "COM" + this->RS232CommPortNum->Value; error C2664: 'System::IO::Ports::SerialPort::SerialPort(System::ComponentModel::IContainer ^)' : cannot convert parameter 1 from 'System::IO::Ports::SerialPort *' to 'System::ComponentModel::IContainer ^' this should work but it is giving me a wierd error. There are seven different overloads for SerialPort() and I dont understand why it is interpreting it this way. Any suggestions? Thanks again. I want to use the SerialPort(SYSTEM string^ portname, int baudrate) |
| ||
| Re: string to int gcnew creates a new managed reference object. You need to declare the variable holding the object as a managed reference: SerialPort^ com = gcnew SerialPort(comPort, baudRate); |
| ||
| Re: string to int Great, I dont have much experience with visual studio forms, thanks a lot for your help. |
| All times are GMT -4. The time now is 11:41 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC