-
Using referenced typelibs when firing events
All
I have this really annoying problem that has had me stumped these last few
days. I have written a control that references the DirectX7a library. This
control raises an userdefined event which includes, as an argument, a
reference to a DX object. The event's declaration looks like this:
Public Event UserPaint(MainSurface As DxVBLib.DirectDrawSurface7)
The problem occurs when you use this control in another application. The
first time you try to run or compile the host application it fails with the
error: "User defined type not defined" with respect to the
'DxVBLib.DirectDrawSurface7' reference in the control's 'UserPaint' event
handler. The handler looks like this
Private Sub DirectView1_UserPaint(MainSurface As DxVBLib.DirectDrawSurface7)
'Draw the groovy graphics
With MainSurface
.SetForeColor RGB(255, 255, 204)
.DrawCircle CircleX, CircleY, 4
.DrawBox BoxX - 7, BoxY - 7, BoxX + 7, BoxY + 7
.DrawLine HLineX - 20, HLineY, HLineX + 20, HLineY
.DrawLine VLineX, VLineY - 20, VLineX, VLineY + 20
End With
End Sub
The 'cure' for this error is simple. You just copy the code in the event
handler, delete the event handler completely, recreate the event handler and
paste the code back in. Then everything is fine until you close and re-open
the project when the error reappears.
Thanks.
Jonny
--
Genetic algorithms, fractals, chaos and fun.
http://www.joyofVB.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks