|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
can't create dll properlyI'm desperately trying to create a dll, register it and then use it as an ActiveX object. My vb.net windows class library : Namespace myMSN Public Class Msg Public Sub New() End Sub Public Function Display() As Boolean MsgBox("hello world") Return True End Function End Class End Namespace I then use regasm /tlb msn.dll (the name of my project is called msn that's why i get a dll called msn.dll when I compile it) Then when I create my ActiveX in JScript: var vbDotNetObject = new ActiveXObject("myMSN.Msg"); vbDotNetObject.Display(); I get an error saying that an ActiveX component cannot create an object. What am I doing wrong, and at which step ? Thank you Two things...
- 'Register for COM Interop' in the projects properties must be set True; - Using System.Runtime.InteropServices should be added. In a VBA module I call it then with: Dim vbDotNetObject Dim b as Boolean Set vbDotNetObject = CreateObject("myMSN.Msg") b = vbDotNetObject.Display() Show quoteHide quote "graphicsxp" <samuelberthe***@googlemail.com> schreef in bericht news:1157754762.964518.290430@h48g2000cwc.googlegroups.com... > Hi, > I'm desperately trying to create a dll, register it and then use it as > an ActiveX object. > > My vb.net windows class library : > > Namespace myMSN > Public Class Msg > Public Sub New() > > End Sub > > Public Function Display() As Boolean > MsgBox("hello world") > Return True > End Function > End Class > End Namespace > > > I then use regasm /tlb msn.dll (the name of my project is called msn > that's why i get a dll called msn.dll when I compile it) > > Then when I create my ActiveX in JScript: > > var vbDotNetObject = new ActiveXObject("myMSN.Msg"); > vbDotNetObject.Display(); > > I get an error saying that an ActiveX component cannot create an > object. > > What am I doing wrong, and at which step ? > > Thank you > hello moon,
Thanks for helping. I've added ' Using System.Runtime.InteropServices' as you mentionned, and I also set the option 'Register for COM Interop to true. Yet if I type the same code as the one you gave me in a excel macro, I get the error ActiveX component can't create object. Same thing in my msn script. What am I missing ??? This is totally driving me crazy now Any help very appreciated thanks moon wrote: Show quoteHide quote > Two things... > - 'Register for COM Interop' in the projects properties must be set True; > - Using System.Runtime.InteropServices should be added. > > > In a VBA module I call it then with: > > Dim vbDotNetObject > Dim b as Boolean > Set vbDotNetObject = CreateObject("myMSN.Msg") > b = vbDotNetObject.Display() > > > > > > "graphicsxp" <samuelberthe***@googlemail.com> schreef in bericht > news:1157754762.964518.290430@h48g2000cwc.googlegroups.com... > > Hi, > > I'm desperately trying to create a dll, register it and then use it as > > an ActiveX object. > > > > My vb.net windows class library : > > > > Namespace myMSN > > Public Class Msg > > Public Sub New() > > > > End Sub > > > > Public Function Display() As Boolean > > MsgBox("hello world") > > Return True > > End Function > > End Class > > End Namespace > > > > > > I then use regasm /tlb msn.dll (the name of my project is called msn > > that's why i get a dll called msn.dll when I compile it) > > > > Then when I create my ActiveX in JScript: > > > > var vbDotNetObject = new ActiveXObject("myMSN.Msg"); > > vbDotNetObject.Display(); > > > > I get an error saying that an ActiveX component cannot create an > > object. > > > > What am I doing wrong, and at which step ? > > > > Thank you > >
Hiding a Property
self-extracting files in .net Writing a brute force program using SendKeys.Send Extending an Abstract class that uses a Generic Parameter Get all forms contained in another project Check for Updates Try to delete a worksheet in Excel File Not Accessed Restricting the resizing of forms Adding row to data table in .net 2.0 |
|||||||||||||||||||||||