Search Persits Software Knowledge Base

 

Article PS021122104

Coding issues under VB

Problem Description

AspJpeg was designed and tested to work under ASP. It can be used under Visual Basic as well. Prior to AspJpeg 1.2.0.1, however, some coding problems occur when using the component in VB.

If you are having problems described below, you should upgrade to AspJpeg 1.2.0.1 (or later). If upgrading is not possible for whatever reason, this article provides workarounds for these problems.

Solution

1. Canvas.Print method is not recognized.

The following line of code

jpg.Canvas.Print 10, 10, "some text"

will generate an error in VB:

Object doesn't support this property or method.

To fix the problem, rewrite your code as follows:

With jpg.Canvas
   .Print 10, 10, "some text"
End With

2. Font.XXXColor properties return an error

When trying to use the properties Color, BkColor and ShadowColor of the Canvas.Font object, the following error is returned:

Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic.

There is no clean workaround for this error. To avoid it, you must change from the early-binding to late-binding model and declare the jpg variable as Object rather than ASPJPEGLib.ASPJpeg. You may still create the object using the New expression, as follows:

Dim jpg As Object
Set jpg = New ASPJPEGLib.ASPJpeg

Created: 11/22/2002 11:19:07 AM
Last Modified: 4/18/2003 4:57:33 PM

Copyright © Persits Software, Inc. 1998 - 2018
For technical support, write to support@persits.com.