Solved

Validation of postcode

Posted on 1998-03-18
4
308 Views
Last Modified: 2010-04-16
How do I validate a postcode using TPW v1.5.
I want it to be validated as I enter each character and if the character is not valid then it should not be printed to the screen.
0
Comment
Question by:McSpud
  • 2
4 Comments
 

Expert Comment

by:Nanos
ID: 1217404
For this to work you must know the algorithm u want to check.. Then use a combination of "readkey" command, then show it using the write/writeln command.... readkey is a command is one of the headers, where it reads the entered valueinto a variable, without displaying it to the screen. If the variable matches certain criteria u can add it to a longer varible, and also show it on the screen!!
Hope it works for u!!
0
 

Expert Comment

by:Nanos
ID: 1217405
I'm not being pushy.. but at least tell me where I went wrong???
0
 
LVL 2

Accepted Solution

by:
omsec earned 20 total points
ID: 1217406
Hi

I'm npt familiar with TPW but in "normal" pascal (TP or BP) can you do that with a simple REPEAT - UNTIL - Loop  like this :

Program Test;

Uses
  Crt;   {or whatever in TPW}

Var
  KeyBoard  : Char;   {Get the key}

Begin
  Writeln;
  Writeln('hit keys as long you want to.');
  Writeln('''Q'', ''H'' and ''X'' will terminate program');
  Writeln;
  Repeat
    KeyBoard := ReadKey; {get key}
    KeyBoard := UpCase(KeyBoard); {make is caps}
    {do your wthings here}
    {all commands}
  Until (KeyBoard = 'Q') or (KeyBoard = 'H') or (KeyBoard = 'X');
End.

Hoping this could help, greets, Omsec :)
0
 

Author Comment

by:McSpud
ID: 1217407
Sorry Nanos, but I was really looking for a bit of code to get me started. Omsec's code is too basic but I have now figured it out using a case statement and adding a character if it fits an if statement. Thanks for taking time to answer my question.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now