CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2000
    Posts
    20

    TextField Please read this I have a Problem Please Help!!

    I am writing an application
    I created one TextField and one Button.
    The user specifies a month and a year on the
    Textfield,
    Ex 11/1999
    then clicks the show button to display the calender for the month of the year
    Now my problem is once I get the String from the text field how can I differentiate between 11 and
    1999.



  2. #2
    Join Date
    Feb 2000
    Posts
    20

    Re: TextField Please read this I have a Problem Please Help!!

    please help


  3. #3
    Join Date
    Jan 2000
    Location
    CA, USA
    Posts
    305

    Re: TextField Please read this I have a Problem Please Help!!

    Search for the '/' delimiter in the string
    and take away the tokens on both sides of it.
    Use StringTokenizer class.

    Kannan



  4. #4
    Join Date
    Sep 1999
    Location
    Madurai , TamilNadu , INDIA
    Posts
    1,024

    Re: TextField Please read this I have a Problem Please Help!!


    Use StringTokenizer to parse the String


    String textFieldString = textField.getText();
    StringTokenizer sToken = new StringTokenizer( textFieldString , "/" );
    if( sToken.countTokens() == 2 ){
    String strMonth = sToken.nextToken();
    String strYear = sToken.nextToken();
    }else{
    // Show Error Message
    }





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

Featured