system :: string to int with VC ++ [英] system::string to int with VC++
问题描述
你好,我有一个问题:s
我试图转换一个system :: string (文本框)到int但我发现
只找到了一个函数将system :: string转换为char和char
转换为int:s:
转换:: ToInt32(PtrToStringChars(ligne23->文本));
但我得到一个错误:你可以帮我吗? (对不起我的英语我是法国人)
hello all, i''ve a problem :s
i''ve tried to convert a "system::string" (a textbox) to an "int" but i
have only found a function to convert system::string to char and char
to int :s :
Convert::ToInt32(PtrToStringChars(ligne23->Text));
but i get a bug :s can you help me ? (sorry for my english i''m french)
推荐答案
我试过转换system :: string (文本框)到int但我只找到了一个函数将system :: string转换为char和char
转换为int:s:
转换:: ToInt32(PtrToStringChars(ligne23-> Text) ));
i''ve tried to convert a "system::string" (a textbox) to an "int" but i
have only found a function to convert system::string to char and char
to int :s :
Convert::ToInt32(PtrToStringChars(ligne23->Text));
将字符串转换为int32应该没有问题:
Convert :: ToInt32(ligne23-> ;文字);
您是否尝试过,如果是这样,那么当您这样做时会发生什么?您输入的输入是什么?b $ b,您获得的输出值是多少?
-
亲切的问候,
布鲁诺。
br ********************** @ hotmail.com
仅删除_nos_pam
It should be no problem to convert a string to an int32 like this:
Convert::ToInt32(ligne23->Text);
Have you tried it, and if so, What happens when you do that? which input do
you supply, and what output value do you get?
--
Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"
大家好,我有一个问题:s
hello all, i''ve a problem :s
我试图转换一个system :: string (文本框)到int但我只找到了一个函数将system :: string转换为char和char
转换为int:s:
转换:: ToInt32(PtrToStringChars(ligne23-> Text) ));
但我得到一个错误:你可以帮我吗? (对不起我的英语我是法国人)
i''ve tried to convert a "system::string" (a textbox) to an "int" but i
have only found a function to convert system::string to char and char
to int :s :
Convert::ToInt32(PtrToStringChars(ligne23->Text));
but i get a bug :s can you help me ? (sorry for my english i''m french)
正如布鲁诺所说,正确的方法是:
转换: :ToInt32(ligne23-> Text);
此外,你应该总是使用包含IFormatInfoProvider的Convert / ToString / Parse / TryParse
重载参数,以确保您的代码
适用于语言环境/文化。所以,例如,你可以这样做:
转换:: ToInt32(ligne23-> Text,CultureInfo :: InvariantCulture);
-
Tomas Restrepo
to****@mvps.org
谢谢,但有这个:转换:: ToInt32(ligne23->文字);
i得到一个错误:
Windows :: Forms :: Control :: Text :: set(System :: String ^)'':无法将
参数1从''int''转换为''System :: String ^''
thanks, but with this : Convert::ToInt32(ligne23->Text);
i get an error :
Windows::Forms::Control::Text::set(System::String ^)'' : cannot convert
parameter 1 from ''int'' to ''System::String ^''
这篇关于system :: string to int with VC ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!