Check input format

  • Thread starter Thread starter BelgianProgrammer
  • Start date Start date
B

BelgianProgrammer

Guest
I am trying to make a program with WPF where the user can enter a Belgian company number. The program should be able to check if the input is the correct format. The format should be "BE 0XXX.XXX.XXX" where X represents an integer. The position of the white space and the points are important.

The validity of the company number can also be checked by a calculation:

for example the company number is BE 0123.456.749.

(first 7 integers of the company number) 1234567 / 97 = 12727.49485

12727 * 97 = 1234519

1234567 - 1234519 = 48

97 - 48 = 49 (last 2 integers of the company number)

when we devide the first 7 integers after the 0 (so 1234567) by 97, we get 12727(.49485). We drop the number after the comma. then we multiply the outcome with 97, we get 1234519. Now we take the original 7 integers (1234567) and subtract 1234519 form it, we get 48. Last step: 97 - 48 = 49. These are the last 2 integers from the company number. That's how we know that the number is valid.

I tried to put the user-input in a char array so that i can use it for the calculation. But i'm seriously stuck. My program doesn't work, whatever I try... Does anyone have some advise for me?

Thank you!

Continue reading...
 

Similar threads

P
Replies
0
Views
176
Policy standard local admin account with Active Di
P
Back
Top