DynaPDF Manual - Page 38
Previous Page 37 Index Next Page 39
Language Bindings
Page 38 of 839
VB .Net supports more data types than VB 6.0 but the usage of the new data types is
complicated. For instance, a signed integer cannot be passed to an unsigned integer variable
without explicit conversion. The same behaviour is required for nearly all other new data types.
This makes the usage of the new types practically impossible.
However, to make the usage of DynaPDF less complicated the VB .Net interface uses only base
data types which are already available since VB 6.0. An exception is the definition of pointers.
VB .Net supports the new Data IntPtr that is a variable pointer type with a length of 32 bit on a
32 bit Windows machine and 64 bit on a 64 bit Windows machine. This data type is used for all
pointers so that the .Net interface can also be used on a 64 bit Windows machine. Note that the
64 bit version of DynaPDF must be used in this case.
Data types used by DynaPDF
DynaPDF uses a large set of enums and other data types which are mostly declared within the
class CPDF. However, a few data types are declared in the file DynaPDFInt.vb, this must be
taken into account when developing VB .Net applications. If you cannot find a data type in the
class CPDF then take a look into the file DynaPDFInt.vb.
Exception handling in VB .Net
The exception handling in Visual Basic .Net is the same as in Visual Basic 6.0. The class CPDF
uses per default events instead of callback functions. This makes the usage easier and frees you
from handling with unmanaged data types. Please take a look into Visual Basic Exception
handling for a detailed description.
It is also possible to declare callback functions instead of events but the use of callback functions
is rather complicated in VB .Net. While C# handles callback functions correctly without further
considerations, VB .Net users must test their callback function properly. It seems that VB .Net
invalidates sometimes the pointers of callback functions if memory must be reallocated. This
error occurs mostly if DynaPDF functions are executed in different classes. If you get a
NullReference exception check whether the same error occurs if no error callback function is set.
If the exception does no longer occur use the error event handling of DynaPDF instead.
The DoEvents problem
The usage of events in VB .Net is quite easy; however, there is a special behaviour that must be
taken into account when developing .Net applications. When using the DoEvents procedure in
a function you must make sure that the function cannot be executed again while a previous call
of the function is still running.
DoEvents enables the asynchronous processing of the message loop so that the user interface
can be updated and the user can execute something while a function is still running (e.g. press a
break button). DoEvents is often used because it is an easy way to avoid blocking of an
application without using of threads.
Previous topic: Visual Basic .Net, 64 Bit Applications, General Note:
Next topic: Visual C#, .Net Core compatibility, Using DynaPDF with Visual Studio, 64 Bit Applications