Results 1 to 4 of 4

Passing data between forms

Threaded View

  1. #1
    Registered User
    Join Date
    02-10-2011
    Location
    Seattle, Wa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Passing data between forms

    Hi all -

    I'm attempting to re-write a customer database I built, using classes and I'm having troubles.

    assigning the varibale to the result of a function - here is the class def
    Class Module name is CEmployee
    Private Pname As String
    Public Property Get name() As String
        name = Pname
    End Property
    Public Property Let name(Value As String)
        Pname = Value
    End Property
    here is the Module with def, and function
    Public PersonsName As String
    Public emp As CEmployee
    Public Function add_Name(name) As String
    Set emp = New CEmployee
        emp.name = name
    End Function
    now the problem comes in with my two forms...
    form 1 code =
    Private Sub CommandButton1_Click()
        PersonsName = add_Name(TextBox1.Value)
        PersonsName = emp.name
        MsgBox PersonsName
    End Sub
    form 2 code =
     
    Private Sub CommandButton1_Click()
        MsgBox PersonsName
    End Sub
    is this the only way to get the result of function. I thought personsname = add_name(textbox1.value) would be enoungh to assign the variable personsname to the result of the add_name() function

    is there a better way to do this?
    Last edited by JamesPLile; 02-15-2011 at 12:32 AM. Reason: forgot to add the [code] tags

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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