Results 1 to 8 of 8

Thread: Passing public property

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    Cleveland,Oh
    Posts
    95

    Passing public property

    Hi All:
    I created a public property on my form3. The property I created is called lVisible. I assigned "F' to this property from Form2. Like so: Form3.lVisible = "F". Than I call form3 like so:
    Load Form3
    Form3.Show 1

    If my form3, I have some code like so:
    Private Sub Form_Activate()
    If Me.lVisible = F Then
    txtbxaddr2.Visible = False
    End If
    txtPerson.SetFocus
    End Sub

    The lVisible property in Form3 is null, even though I am setting the value to "F" in form. What am I doing wrong?
    Thanks
    Zus

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Try loading it first then setting the property, then showing it.

    VB Code:
    1. Load Form3
    2. Form3.lVisible = "F"
    3. Form3.Show 1


    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    Cleveland,Oh
    Posts
    95
    Still the value of lVisible is emtpy. What do I do next?
    Zus

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    Cleveland,Oh
    Posts
    95

    Public variable

    Hi:
    I still need some help on setting a value on a public property.
    I created a public property on form 3 the property is called lVisible.

    Before I call form3 this is what I do:

    Private Sub cmdaddpersoncollect_Click()
    Form2.Hide
    Load Form3
    Form3.lVisible = "F"
    Form3.txtPerson.Text = RTrim(ComboPrsTicket.Text)
    Form3.Show 1
    End Sub

    In Form3, the lVisible is empty. What do I need to do in order to save the value I store in lVisible in Form2?

    Thanks
    Zus

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    What does the code behind your property look like?

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    Cleveland,Oh
    Posts
    95

    Public variable

    I do not have any code behind the property.

    Public Property Get lVisible() As Variant

    End Property

    Public Property Let lVisible(ByVal vNewValue As Variant)

    End Property

    What code should I add behind the property?
    Zus

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    OK,..... now the source of the problem has been exposed. You've created the property, but not told it where to hold the data.

    VB Code:
    1. dim mvarIVisible as Variant
    2.  
    3. Public Property Get lVisible() As Variant
    4.   IVisible = mvarIVisible
    5. End Property
    6.  
    7. Public Property Let lVisible(ByVal vNewValue As Variant)
    8.   mvarIVisible = vNewValue
    9. End Property

    And you really should type case the property (and the related variable) to a specific type.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8

    Thread Starter
    Lively Member
    Join Date
    May 2004
    Location
    Cleveland,Oh
    Posts
    95

    Public variable

    Thank you very much that was it.
    Zus

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