Results 1 to 5 of 5

Thread: Geting addresses of variables

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Slovenia, Europe
    Posts
    58
    How do you get an address of a variable?
    The set keyword doesn't work.
    I would like to pass the address of a boolean variable
    to a form I'm loading through Sub Init so i know that the
    form is finished in the procedure I'm loading it from.

    Public Finished As Boolean

    Public Sub Init(ByRef Fin As Boolean)
    Set Finished = Fin
    End Sub

    Basicly I would like to set the address of Fin to the address of Finished.

    Thanx, Tadej

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    The Best Way is to Make a Simple Class Module Wrapping a Bolean, VB's Class Builder Gave me this
    Code:
    Option Explicit
    
    'local variable(s) to hold property value(s)
    Private mvarValue As Boolean 'local copy
    Public Property Let Value(ByVal vData As Boolean)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.Value = 5
        mvarValue = vData
    End Property
    
    
    Public Property Get Value() As Boolean
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.Value
        Value = mvarValue
    End Property

    Whenever you Pass This Around it will be passed By Reference, ie the instances set = to each other all point to the Same Address.


    Hope this Helps

  3. #3
    Lively Member
    Join Date
    Jul 2000
    Posts
    94

    Lightbulb Pointer variables?

    It might be possible to declare pointer variables in VB - I know you can do this in pure C++ but I'm not sure about VB. Pointer variables hold memory addresses, you see.

    If I figure out how to do this I'll let you know soon - ok?

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Slovenia, Europe
    Posts
    58
    I know about pointers in C++.
    I'm wondering if there is any way of
    doing this in VB.
    Or is it only possible in VB to set references
    of objects with the Set statement.

    Thank you for answering,

    Tadej

  5. #5
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    There's nothing in VB that concerns pointers,The Set Statement sets reference to an object, unfortunatley normal booleans aren't objects, which is why you need to create the class.

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