Passing picturebox to a class

Posted on 2005-03-03
Medium Priority
Last Modified: 2010-05-02

I would like to build a class which would have a property to which I could assign a picturebox.
Later I would like this class to operate on this picturebox. My idea is to make the class semi-inherit properties of the picturebox. How to make such a reference?


Question by:eyore
  • 2
  • 2
LVL 28

Expert Comment

ID: 13455141
Private WithEvents m_PB As PictureBox

Public Property Set AttachedPB(pb As PictureBox)
   Set m_PB = pb
End Property

Public Property Get AttachedPB() As PictureBox
   Set AttachedPB() = m_PB
End Property

Private Sub m_PB_MouseDown(...)
End Sub

Author Comment

ID: 13459326
Yeah, but if now what do i actually pass to this function?
I mean :


LVL 28

Accepted Solution

Ark earned 1000 total points
ID: 13463635
Set Class.AttachedPB=Picture1 'Where picture1 is picturebox

Author Comment

ID: 13469993
Oh yeah - now it works - I missed the 'set' command when assigning.


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question