Search Tools Links Login

UDT Calculator

Calculates the length of a UDT (User Defined Type) required to store it in a String using CopyMemory, MoveMemory or any simular API. (So you can easily save it or transfer it over Internet.) NEVER use Len() or LenB() for this, they both return the incorrect length. (Len often returns less bytes, LenB often returns way more)

The code of this application is not impressive at all. The thing is, no-one ever seemed to have found a way to get the exact string length to store a UDT in, until now :D

Usage: Just add the types with their sizes to the list in the same order as your UDT is and the length is displayed below in a textbox.

Note: I will work on a UDT Calculator that can analyze your code pasted in a textbox later.

You vote would be nice, but never mind if you're short on time :P

Original Author: Pascal vd Heiden


UDT User Defined Type String Len LenB Length CopyMemory MoveMemory


Know how to use CopyMemory/MoveMemory and UDT's.


UDT String Len LenB Length

Side Effects

It may not be correct for VB4 and older, or .NET. Only tested for VB5 and VB6.

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 92 times


Visual Basic 6

Posted: 9/3/2020 3:45:00 PM
Size: 4,783 bytes

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.