Results 1 to 9 of 9

Thread: String data type internat representation

  1. #1

    Thread Starter
    Hyperactive Member divined's Avatar
    Join Date
    Aug 2004
    Location
    Thessaloniki, Greece
    Posts
    447

    Resolved String data type internat representation

    Hello everybody

    I was wondering what the internal encoding of a String data type is in VB6. Is it Unicode or ACSII?
    Also, in my application I store strings embedded in the code. Is there a better way? Something like a string table in Visual C++ 6.0.

    thx, in advance

    George Papadopoulos
    Last edited by divined; May 30th, 2005 at 12:57 AM.
    SteadFast!

  2. #2
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011

    Re: String data type internat representation

    Its ASCII

  3. #3
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: String data type internat representation

    There isn't a direct "String Table" functionality in Visual Basic. There may be an add-in which allows it. People talk alot about MZTools, although I haven't used it before, and really don't know about it at all.

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: String data type internat representation

    You can use text = StrConv(text, vbUnicode)
    to store strings that are 2 byte Unicode.

  5. #5

    Thread Starter
    Hyperactive Member divined's Avatar
    Join Date
    Aug 2004
    Location
    Thessaloniki, Greece
    Posts
    447

    Re: String data type internal representation

    ok. But can I store these Unicode converted strings in the default VB6 String type or do I need to create an array of my own?
    SteadFast!

  6. #6
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: String data type internat representation

    Looks like string type works.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. Dim a As String
    5. Dim b As String
    6.   a = "test"
    7.   b = StrConv(a, vbUnicode) ' is just "t" at this point
    8.   a = StrConv(b, vbFromUnicode)
    9.   MsgBox a ' prints "test"
    10. End Sub

    I started with B as a variant, and changed it back into a string.

  7. #7
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: String data type internat representation

    Yes it is possible!
    Use AddIn Manager to load Resource Editor. Create a resource file. Here you can store your strings etc. exactly in a table type format and it is embedded into your exe. You won't need any external tool.

  8. #8
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: String data type internat representation

    Doh. I'd never bothered with Resource Files in VB, I assumed they were different than their C++ counter-parts.

    Meh, that's my stretch of experimentation for you.

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  9. #9

    Thread Starter
    Hyperactive Member divined's Avatar
    Join Date
    Aug 2004
    Location
    Thessaloniki, Greece
    Posts
    447

    Re: String data type internat representation

    From what I`ve got running dglienna`s code I have these comments :

    a) The value of b is actually t e s t . At least that is what I get in Debug mode, using Debug.Print.
    b) It seems that the MsgBox function cannot handle correctly the two-byte Unicode string. That is why it prints a single 't'.

    Am I wrong somewhere?
    SteadFast!

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