Results 1 to 6 of 6

Thread: Very very simple question to everyone

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 1999
    Location
    Vilnius, Lithuania
    Posts
    50

    Post

    How to get the length of string?

    for egzample i have "WholyGvakamoly"
    and i need to get number 14 (the length)

  2. #2
    Guest

    Post

    Use Len(string)

    It will return the length of a string.

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 1999
    Location
    Vilnius, Lithuania
    Posts
    50

    Post

    Well i tried that before
    and VB says "indentifier expected" or something like that

    could anyone please write the sample code

  4. #4
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    did you miss off a " ?


    msgbox len("WholyGvakamoly")

    works
    as does

    dim strTemp as string
    stremp = "WholyGvakamoly"

    msgbox len(strtemp)




    ------------------
    Mark Sreeves
    Analyst Programmer

    Mark.Sreeves@Softlab.co.uk
    A BMW Group Company

  5. #5
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    Hi,casparas!
    Put command button and Text box on your form:

    Private Sub Command1_Click()

    Dim YourString As String
    Dim LengthOfYourString As Integer

    YourString = "WholyGvakamoly"
    LengthOfYourString = Len(YourString)
    Text1 = LengthOfYourString
    End Sub

    After you click the button,you'll see in text box - 14

    Good luck.
    Larisa

  6. #6

    Thread Starter
    Member
    Join Date
    Dec 1999
    Location
    Vilnius, Lithuania
    Posts
    50

    Post

    Thank you very much that's exactly what i needed

    -Casparas

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