Picturebox control in my own object ?

05-03-2002, 03:55 PM
at the moment I am just trying to get into VB by exoanding a program bit by bit.

Now I have a problem, which I couldnt resolve so far:
In my program I use a picturebox as a kind of "visual timer" by filling circle segments every second until it is full.

It works nicely, but I would prefer to make an object out of it.
I can define the object in my class module, but as soon as I refer to the Picturebox inside I get a runtime error.

Cant you use control elements in your own classes ?

Thx for an answer, hope I made myself clear halfway

Public CTPictureBox As PictureBox
Public Duration As Integer
Public Interval As Integer

Public Sub Start()
MsgBox "here comes the circle later"
End Sub

Private Sub Class_Initialize()
CTPictureBox.BackColor = vbRed ***** does not work
End Sub

05-03-2002, 04:00 PM
A class object has no interface so basically you can't have a picturebox.

What you want is an ActiveX control, which is similar to a class, but has a "form" on which you can put controls.

05-03-2002, 09:10 PM
got to think about it and read a bit more ;)

thx nevertheless

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum