try & catch

hi anyone know how to use try & catch for a text field so it will only allow int to b key in.

Plase help thank.

Regards,
Adrian

Comments

  • : hi anyone know how to use try & catch for a text field so it will only allow int to b key in.
    :
    : Plase help thank.
    :
    : Regards,
    : Adrian
    :
    read the data in as a string(reading it as an integer is poor practice and can lead to tons of issues). use Integer.parseInt(String) inside a try block and catch NumberFormatException.
    [italic][blue]Just my 2 bits[/blue][/italic]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion