B
Buddhike de Silva
Hi,
I created a small serviced component using VB.net.
It has an interface and a class as dfefined as follows.
CEvent.vb
---------
Imports System.EnterpriseServices
Public Class CEvent
Inherits ServicedComponent
Implements IEvent
Public Sub LogMsg(ByVal c As String, _
ByVal a As Long, _
Optional ByVal b As Int64 = 0) _
Implements IEvent.LogMsg
End Sub
End Class
IEvent.vb
----------
Imports System.Runtime.InteropServices
<InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IEvent
Sub LogMsg(ByVal c As String, _
ByVal a As Long, _
Optional ByVal b As Int64 = 0)
End Interface
This compiles and builds fine. But when I try to register
this in my Windows 2000 professional machine the
regsvcs.exe program ends up with following error.
TlbExp error: Type library exporter encountered an error
while processing 'Event
Class.IEvent.LogMsg(b), EventClass'. Error: Bad variable
type.
What I noticed was when I removed the optional keyword
from the definition this works fine. Also this comes when
the optional value type is Long or something bigger than
it.
Please let me know if you know any answer.
..
I created a small serviced component using VB.net.
It has an interface and a class as dfefined as follows.
CEvent.vb
---------
Imports System.EnterpriseServices
Public Class CEvent
Inherits ServicedComponent
Implements IEvent
Public Sub LogMsg(ByVal c As String, _
ByVal a As Long, _
Optional ByVal b As Int64 = 0) _
Implements IEvent.LogMsg
End Sub
End Class
IEvent.vb
----------
Imports System.Runtime.InteropServices
<InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IEvent
Sub LogMsg(ByVal c As String, _
ByVal a As Long, _
Optional ByVal b As Int64 = 0)
End Interface
This compiles and builds fine. But when I try to register
this in my Windows 2000 professional machine the
regsvcs.exe program ends up with following error.
TlbExp error: Type library exporter encountered an error
while processing 'Event
Class.IEvent.LogMsg(b), EventClass'. Error: Bad variable
type.
What I noticed was when I removed the optional keyword
from the definition this works fine. Also this comes when
the optional value type is Long or something bigger than
it.
Please let me know if you know any answer.
..