Board index » delphi » Case statement : How to check on an editbox in a case-statement??

Case statement : How to check on an editbox in a case-statement??

The problem looks like this
Case edit1.text of
        'VM' : .......
        'TE' : .....
..
else
..
The case statement requires an ordinal type. How can I solve this??
Suggestions & tips are welcome and would be greatly appreciated.
Tom

 

Re:Case statement : How to check on an editbox in a case-statement??


In article <3336669A.6...@babbage.hogent.be>,
   Tom De Decker <94021...@babbage.hogent.be> wrote:
]-The problem looks like this
]-Case edit1.text of
]-      'VM' : .......
]-      'TE' : .....
]-...
]-else
]-...
]-The case statement requires an ordinal type. How can I solve this??
]-Suggestions & tips are welcome and would be greatly appreciated.

one method is to write a function that takes a string argument
and returns some sort of ordinal value...

  function convert(const S : string) : integer;

  Case convert(edit1.text) of
    17 : .......
    32 : .....

Mark Vaughan

Re:Case statement : How to check on an editbox in a case-statement??


Tom,

I can't think of anything immediately off the top of my head, but why
can't you just use an if/then/else type construct in this instance?

--
Daryl Richter     "Cool Zephyr"     d...@pwrteam.com
^^^^^^^^^^^^^     ^^^^^^^^^^^^^     ^^^^^^^^^^^^^^^^

Quote
Tom De Decker wrote:

> The problem looks like this
> Case edit1.text of
>         'VM' : .......
>         'TE' : .....
> ..
> else
> ..
> The case statement requires an ordinal type. How can I solve this??
> Suggestions & tips are welcome and would be greatly appreciated.
> Tom

Other Threads