Results 1 to 8 of 8

Thread: If the last character of a string is "P" ...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2003
    Location
    Greece, Salonica
    Posts
    473

    If the last character of a string is "P" ...

    Hi...
    Im pretty sure that this is simple...
    But i cant get it !
    Anyway i want to check if the last character of a textbox is "P"
    Can anyone help with that?

    Thanks!

  2. #2
    Member
    Join Date
    Apr 2004
    Location
    Chennai,India
    Posts
    40
    try
    if UCASE(right(TRIM(text1.text),1)) = "P" Then ....

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2003
    Location
    Greece, Salonica
    Posts
    473
    Nope...
    Doesnt work...

  4. #4
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    VB Code:
    1. If LCase(Right(Text1.Text, 1)) = "p" then
    2.    MsgBox "Last chr is P"
    3. End If

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2003
    Location
    Greece, Salonica
    Posts
    473
    Didnt work either...

  6. #6
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989
    Then you are doing something wrong.
    Can you post your project?

    Here is my example of the project and it works fine.
    Attached Files Attached Files

  7. #7
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    Originally posted by mike2
    Didnt work either...
    What is the problem?


    Has someone helped you? Then you can Rate their helpful post.

  8. #8
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016
    maybe you have a carraige return at the end of your text because trim wont trim with that there, try this.
    VB Code:
    1. If Right$(Trim(Replace(Text1.Text, vbCrLf, "")), 1) = "p" Then
    2.   MsgBox "p is the last char"
    3. End If

    casey.

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