Results 1 to 2 of 2

Thread: Help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2002
    Location
    USA
    Posts
    432

    Help

    ok im getting mad errors when i do this what is the correct way to do this?

    Code:
    intPieces = Integer.valueOf(txtPieces.getText().valueOf());

  2. #2
    Addicted Member HairyDave's Avatar
    Join Date
    Aug 2002
    Location
    Er...I can't remember.
    Posts
    196
    What are the value data types? I assume (may be wrong) that you're tryiung to convert a string to an integer value..?

    If thats so, you can use:

    int val = Integer.parseInt(stringValue);

    You should remember that these sort of conversion methods throw exceptions when they fail - e.g. it's not a number value, therefore you should place try, catch to contain the problem.

    Hope this is OK

    HD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width