Re: How to define the input type in TextBox?
Dear David,
Thanks for you reply! I have following the book to write the program, it is
show follow;
-----------------------------------------------------------------------------------------------------------------------------------
private: System::Void txtQty_TextChanged(System::Object^ sender,
System::EventArgs^ e) {
int n500, n100, n50, n10, n1, amt, change;
try
{
amt=txtPrice->Text->ToInt32(0)*txtQty->Text->Text->ToInt32(0);
txtSum->Text=amt.ToString();
txtChange->Text=(txtPay->Text->ToInt32(0)-amt).ToString();
change=txtChange->Text->ToInt32(0);
n500=change/500;
change%=500;
n100=change/100;
change%=100;
n50=change/50;
change%=50;
n10=change/10;
change%=10;
lbl500->Text=n500.ToString();
lbl100->Text=n100.ToString();
lbl50->Text=n50.ToString();
lbl10->Text=n10.ToString();
lbl1->Text=n1.ToString();
}
catch(Exception *err)
{
return;
}
}
-----------------------------------------------------------------------------------------------------------------------------------
ToInt32(0)<------ From book explain, it is a 32-bit Integer when I input the
number, but I can not run it on my computer.
The book is Visual C++ 2003. Can it running on Visual C++ 2008? If no,
please give my any suggestion!
Thanks!
Ricky
"David Wilkinson" <no-reply@effisols.com> ?????????
news:OgEp4hCDJHA.4176@TK2MSFTNGP04.phx.gbl ?????????...
RickyChan wrote:
Dear All,
Hello, I am a beginner. I have the question of the TextBox.
Do anyone can talk me that how to define the input type in TextBox.
If I input the number. may I change it type? What is it format? Please
reply to me. Thanks!
Ricky:
Only text may be put in a textbox. If you have another kind of data you
must convert it yourself (or use MFC, which can do it for you).
--
David Wilkinson
Visual C++ MVP