Results 1 to 4 of 4

Thread: STRING() won't work

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    16

    STRING() won't work

    Does anyone know how to make the STRING() function work in VB.Net. The samples do not seem to work which makes me believe there is a class missing. What class is it a part of?

    e.g. STRING(10,"*") or rc = STRING(10,"*")

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    I spent a lot of time trying to find a substitute function. There isn't one!!! but there's an easier way

    VB Code:
    1. Dim rc As String
    2.         rc = New String("*", 10)



  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    16

    Loop

    Thanks, your way looks nice and short which I like. I got away with creating a loop for the number of characters and concactenated the string to itself.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    String is a class now thats why it isn't a function name anymore, but the string class has a PadLeft and PadRight function that does what String used to.

    VB Code:
    1. Dim str As String = ""
    2.         str = str.PadLeft(10, "*")
    3.         MsgBox(str)

    Although Mr. Polite's way is better if it is starting that way.
    Last edited by Edneeis; Jul 12th, 2002 at 06:31 PM.

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