vb.net - Error occurred while connecting/creating automation server for ClassLibrary1.classname -
i built dll visual basic 2010 express. it's built on vb 4.0 framework. after building, ran on admin command prompt:
c:\windows\...v4.0.30319\regasm c:\...\bin\release\classlibrary1.dll
the com-visible check box checked. other program can't connect it, error message mentioned in title.
the class library contains 1 class. it's in smscomms.vb:
imports system imports system.threading imports system.componentmodel imports system.io.ports public class smscomms private withevents smsport serialport private smsthread thread private readthread thread shared _readport boolean = false public event sending(byval done boolean) public event datareceived(byval message string) public sub new() end sub public sub initport(byval commport string) smsport = new serialport smsport .portname = commport .baudrate = 19200 .parity = parity.none .databits = 8 .stopbits = stopbits.one .handshake = handshake.requesttosend .dtrenable = true .rtsenable = true .newline = vbcrlf end end sub public function testfunction() integer return 1 end function public function sendsms(byval receiver string, byval message string) boolean if smsport.isopen = true 'sending @ commands smsport.writeline("at+cmgf=1" & chr(13)) 'set command message format text mode(1) 'smsport.writeline("at+csca=+639170000130" & chr(13)) 'set service center address (which varies service providers (idea, airtel)) smsport.writeline("at+cmgs=" & chr(34) & receiver & chr(34) & chr(13)) ' enter mobile number whom want send sms smsport.writeline(message & chr(26)) 'sms sending smsport.close() return true end if return false end function public sub open() if not (smsport.isopen = true) smsport.open() end if end sub public sub close() if smsport.isopen = true smsport.close() end if end sub end class
i used visual basic 2012 instead. there's checkbox com interop.
Comments
Post a Comment