+ Reply to Thread
Results 1 to 3 of 3

Clearing all values in a User Defined Type variable

  1. #1
    J Streger
    Guest

    Clearing all values in a User Defined Type variable

    I have:

    Public Type TPETC_COLS
    Sort As Integer
    AStart As Integer
    RStart As Integer
    SStart As Integer
    RComplete As Integer
    SComplete As Integer

    End Type

    But in the middle of the code I want to ensure all values in the type are
    set to 0, I just want to know if there is an easier way to do this rather
    than declaring each one as 0. Thanks.

    --
    *********************
    J Streger
    MS Office Master 2000 ed.
    MS Project White Belt 2003


  2. #2
    Tom Ogilvy
    Guest

    RE: Clearing all values in a User Defined Type variable

    On way would be to declare a dummy variable as the same type. Then use lset
    to reset

    sub abc(
    b as TPETC_COLS
    mydum as TPETC_COLS

    ' work with b, never touch mydum

    ' now to reset

    lset b = mydum

    ' b is now reset

    End Sub


    If you have a fixed array of these variables and you want reset them all,
    then you can use erase


    sub abc(
    b(0 to 10) as TPETC_COLS


    ' work with b, never touch mydum

    ' now to reset all the type variables in the array

    erase b

    ' all variables in b are now reset

    End Sub

    --
    Regards,
    Tom Ogilvy


    "J Streger" wrote:

    > I have:
    >
    > Public Type TPETC_COLS
    > Sort As Integer
    > AStart As Integer
    > RStart As Integer
    > SStart As Integer
    > RComplete As Integer
    > SComplete As Integer
    >
    > End Type
    >
    > But in the middle of the code I want to ensure all values in the type are
    > set to 0, I just want to know if there is an easier way to do this rather
    > than declaring each one as 0. Thanks.
    >
    > --
    > *********************
    > J Streger
    > MS Office Master 2000 ed.
    > MS Project White Belt 2003
    >


  3. #3
    J Streger
    Guest

    RE: Clearing all values in a User Defined Type variable

    Thank you Tom.
    --
    *********************
    J Streger
    MS Office Master 2000 ed.
    MS Project White Belt 2003



    "Tom Ogilvy" wrote:

    > On way would be to declare a dummy variable as the same type. Then use lset
    > to reset
    >
    > sub abc(
    > b as TPETC_COLS
    > mydum as TPETC_COLS
    >
    > ' work with b, never touch mydum
    >
    > ' now to reset
    >
    > lset b = mydum
    >
    > ' b is now reset
    >
    > End Sub
    >
    >
    > If you have a fixed array of these variables and you want reset them all,
    > then you can use erase
    >
    >
    > sub abc(
    > b(0 to 10) as TPETC_COLS
    >
    >
    > ' work with b, never touch mydum
    >
    > ' now to reset all the type variables in the array
    >
    > erase b
    >
    > ' all variables in b are now reset
    >
    > End Sub
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "J Streger" wrote:
    >
    > > I have:
    > >
    > > Public Type TPETC_COLS
    > > Sort As Integer
    > > AStart As Integer
    > > RStart As Integer
    > > SStart As Integer
    > > RComplete As Integer
    > > SComplete As Integer
    > >
    > > End Type
    > >
    > > But in the middle of the code I want to ensure all values in the type are
    > > set to 0, I just want to know if there is an easier way to do this rather
    > > than declaring each one as 0. Thanks.
    > >
    > > --
    > > *********************
    > > J Streger
    > > MS Office Master 2000 ed.
    > > MS Project White Belt 2003
    > >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1