Click to See Complete Forum and Search --> : objectname from within a variable
aussiejoe
Jan 22nd, 2000, 02:00 PM
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
andymac
Jan 22nd, 2000, 03:35 PM
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
DiGiTaIErRoR
Jan 22nd, 2000, 05:10 PM
Ummm...
Text1.Text = "New text"
That?
Or if you REALLY want a function do this:
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
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.