Recent

Author Topic: Newbie question about text boxes.  (Read 4452 times)

ES5DWXL

  • Newbie
  • Posts: 2
Newbie question about text boxes.
« on: September 08, 2007, 07:43:37 am »
First, sorry if I posted at a wrong place or if this question is stupid question.

I am wanting to make a program what converts wavelengths to frequency and vice versa. However, there is a problem with a text box. Any value, even numeral value entered there is being treated like a text and therefore, if I want to do calculations, type mismatch error occurs. Is there any sorts of controls what allow inputting numbers?

Any help will be appreciated

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1946
RE: Newbie question about text boxes.
« Reply #1 on: September 08, 2007, 11:42:05 am »
If I understand your question, you should probably learn the basics of Pascal first ;-)
http://www.delphibasics.co.uk/

You have to convert Strings to the type you wish to have like
StrToInt(..);
StrToIntDef(..);
StrToFloat(..);
....

You could also use TSpinEdit or TFloatSpinEdit, which only allow Integer or Single as input.

ES5DWXL

  • Newbie
  • Posts: 2
RE: Newbie question about text boxes.
« Reply #2 on: September 08, 2007, 12:17:05 pm »
I must revise them then... I have done only command line programs before so I guess I need to take some extra classes :)

 

TinyPortal © 2005-2018