Results 1 to 3 of 3

Thread: objectname from within a variable

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    MFAU
    Posts
    19

    Post

    i would like to place an object name in a variable for later use, for example if i call the function DoThis() like so
    DoThis(Text1)
    where Text1 is a valid textbox, within the function DoThis i then wish to change the contents of that text box, can anyone help me out?
    Thanks

  2. #2
    Lively Member
    Join Date
    Jan 2000
    Location
    North Yorkshire
    Posts
    102

    Post

    Hi,

    ---START---
    dim mtxtBox as textbox

    function DoThis(ltxtbox as textbox)
    set mtxtbox = ltxtbox
    end function

    then you can have a function using it;

    function DoThis_DisplayEnd()
    mtxtbox.text = "END"
    end function

    Is that what you're looking for ?

    cheers

    Andy

  3. #3
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    Ummm...
    Text1.Text = "New text"
    That?
    Or if you REALLY want a function do this:
    Code:
    Public Function ChgTxt(TxtBox As TextBox, NewTxt As String)
    TxtBox.Text = NewTxt
    End Function
    
    Private Sub Command1_Click()
    ChgTxt Text1, "Hi"
    End Sub
    Good luck, you'll need it!?

    ------------------
    DiGiTaIErRoR

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