Results 1 to 4 of 4

Thread: compare UDT

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Posts
    22

    compare UDT

    HI everyone

    I have two instance of a UDT (user defined type) that I need to compare. The UDT contains variable-length strings, longs, integers, singles, and booleans, altogether about 50 data members.

    I need to compare the two and determine if any data members have different values. If any data member is different, I need the name of the data member and the values.

    I could write if statements to access each member and compare it, but doing that 50 times is pretty cumbersome. Is there a more elegant method?

    I'm running VB6.
    suggestions are apprecaited

  2. #2
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    nope, not with VB6.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Posts
    22
    are you saying its possible with vb.net?

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    Even if you did a byte-by-byte comparison they would never be equal. When you use a variable length string, you are actually referencing a Long that contains the address of the first byte of a Unicode character array. So, the corresponding strings in each UDT will contain different addresses

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