Results 1 to 3 of 3

Thread: Resetting UDT

  1. #1

    Thread Starter
    Lively Member Ceri's Avatar
    Join Date
    Sep 2000
    Posts
    72

    Angry

    I have defined many UDT's in my project as Public becase they are used throughout. I have a reset button on the main form but when this is clicked i dont want to do the following:-

    UDT1.String1 = ""
    UDT1.Int1 = 0
    UDT2.String1 = ""
    UDT2.Long1 = 0

    it's too much of a long proccess, so what i want to do is reset it by using just the name of the UDT, e.g.

    UDT1 = Nothing (obviously this doesn't work thought)

    Any help would be appreciated

    P.S I cant set UDT's to PRIVATE because they are used in many forms.

  2. #2
    Guest
    This is the perfect case for ZeroMemory.
    Code:
    'In a module
    Public Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (pDest As Any, ByVal cbZero As Long)
    Public Sub ResetUDT(MyUDT)
        ZeroMemory MyUDT, Len(MyUDT)
    End Sub
    Usage:
    Code:
    ResetUDT AnyUDTComesHere
    Good luck!

  3. #3

    Thread Starter
    Lively Member Ceri's Avatar
    Join Date
    Sep 2000
    Posts
    72

    Smile How did i know it would be an API

    I knew it would be an API somehow

    Thanks for the help

    much appreciated (if that is hoe you spell it)


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