How is this possible? (array copy fails)-VBForums
Results 1 to 5 of 5

Thread: How is this possible? (array copy fails)

  1. #1

    Thread Starter
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,418

    Question How is this possible? (array copy fails)

    Hello,

    Clearly the image speaks for itself.
    What can be the cause for the custom udt array db_Merge not copying over to tmpData ?

    Name:  ArrayCopyError.jpg
Views: 124
Size:  11.4 KB
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  2. #2
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,819

    Re: How is this possible? (array copy fails)

    Do you have an "On Error Resume Next" in this part of your code?

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    16,415

    Re: How is this possible? (array copy fails)

    And can you show us how those two variables are declared? I'm guessing both as the same UDT structure, but better to ask as maybe one is variant? Maybe show us the UDT structure also.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {GDI+ Classes/Samples} {Unicode Open/Save Dialog} {Icon Organizer/Extractor}
    {VB and DPI Tutorial} {XP/Vista Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4

    Thread Starter
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,418

    Re: How is this possible? (array copy fails)

    Quote Originally Posted by Arnoutdv View Post
    Do you have an "On Error Resume Next" in this part of your code?
    I have an On Error goto [end of sub] with msgbox + erl, which shows a 'Object Variable or With block variable not set'

    Quote Originally Posted by LaVolpe View Post
    And can you show us how those two variables are declared? I'm guessing both as the same UDT structure, but better to ask as maybe one is variant? Maybe show us the UDT structure also.
    No variants. Both are the same UDT. The idea was to avoid duplicating the same code twice, so I want to use a tmpData to take over.
    I must admit, the UDT is a lil complex, but this works %90 of the time. Only on certain occasions 'which I'm yet to trace', does this happen.
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  5. #5
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    2,969

    Re: How is this possible? (array copy fails)

    I'll bet this is a VB6 bug I found a while back. When copying UDT arrays, it'll perform the copy even when the two UDTs aren't declared the same. And then, you can get into big trouble, possibly writing into memory areas you shouldn't be writing into.

    If the two UDT arrays are declared the same, then it's something different.

    I'll try and find the original thread and then come back and edit this post. Here it is, the original thread where this bug was documented.

    EDIT: some1uk03, you were posting when I was, but be sure to stare hard at the declaration of tmpData, dB, and db_Merge, making sure they're definitely declared with the same UDT Type declaration. The compiler (nor the IDE in p-code) won't catch it if they're not.
    Last edited by Elroy; Apr 15th, 2017 at 06:04 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.