Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Referencing Controls

Status
Not open for further replies.

jtmach

Programmer
Jul 26, 2001
88
US
Hopefully this will be an easy question. I need to find out how to pass controls, an example is below.
Code:
Private Sub Text1_Click()
    Dim aControl As control
    aControl = Text1
    moveControl (aControl)
End Sub

Public Function moveControl(aControl As control)
    aControl.Left = 0
End Function
I am trying to be a better programmer, and I need to do this in order to make my code as OO as possible. I know I also need to stop using the "public function", but I will get into passing functions byRef another day. Unless you have a hint for me (hint hint). Anyway, any help you could give me would be appreciated. Thank you. The hardest questions always have the easiest answers.
 
When I try that I get an error.

Run Time Error '424':
Object Required

I tried swithing to
Public Function moveControl(aControl As Object)
but that did not seem to help, same error. The hardest questions always have the easiest answers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top