Results 1 to 4 of 4

Thread: sized strings in vbs

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Okinawa, Japan
    Posts
    271

    sized strings in vbs

    explanation

    Im calling a method of a COM object that takes a sized string as a parameter and fills it with the adapternames on the computer.

    VB Code:
    1. 'dim sized string
    2. Dim AdapterNames as String * 1000
    3. Dim AdapterList as String
    4. 'call the method to fill the string
    5. vpacket.GetAdapterNames(AdapterNames)
    6. AdapterList=Split(AdapterNames,vbNullChar)

    This works fine and I get a Array of Strings with the adapter names.

    But, Im not sure how to go about doing the same thing in vbs
    heres what i was trying.

    VB Code:
    1. Dim AdapterNames
    2. set vpacket=createobject("vbPcap.vbPacket")
    3. AdapterNames=string(1000," ")
    4. vpacket.GetAdapterNames(AdapterNames)

    The AdapterNames doesnt get filled with the data like in vb.
    Actually it doesnt get changed at all.
    Am i trying something that cant be done in vbs?
    Can someone point me in the right direction here.

    thanks
    packetvb

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    VBScript only has one data type...Variant.
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3
    Fanatic Member
    Join Date
    Jul 2001
    Location
    London UK
    Posts
    671
    If you just want a string 1000 characters long you can use the Space(1000) function.

    I'm not sure that it will help though!

  4. #4
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    If you just want the first 1,000 why not just use Left(YourStuff, 1000)?

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