By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,066 Members | 1,841 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,066 IT Pros & Developers. It's quick & easy.

HRESULT: 0x800A1F52 error when running mscomm

P: 25
I get the following error message when I output to the mscomm:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in COM.exe
Additional information: Exception from HRESULT: 0x800A1F52.


No one has been able to tell me why this isn't working. I know VB 2003 doesn't have serial control however I need to send this with the mscomm.


It will break at the line : comm1.Output = Packet(i)

Expand|Select|Wrap|Line Numbers
  1. Private comm1 As New MSComm
  2.  
  3. Public Sub SetupCOM(ByVal comPort As Integer)
  4. If IsNothing(comm1) Then
  5.     comm1 = New MSComm
  6. End If
  7. 'set the properties of the com port
  8. comm1.CommPort = comPort
  9. comm1.Settings = "57600,n,8,1"
  10. 'open the port and clear the buffer if it is not already open (which it better not be)
  11. If Not comm1.PortOpen Then
  12.     comm1.PortOpen = True
  13.     comm1.InBufferCount = 0
  14.     System.Threading.Thread.CurrentThread.Sleep(100)
  15. End If
  16. End Sub
  17.  
  18. Public Sub GetIndicator_Info()
  19. Dim i As Integer
  20. Dim Packet(6) As Byte
  21. Packet(0) = 42
  22. Packet(1) = 6
  23. Packet(2) = 7
  24. Packet(3) = 28
  25. Packet(4) = 45
  26. Packet(5) = 48
  27. Packet(6) = 130
  28.  
  29. For i = 0 To 5
  30.     comm1.Output = Packet(i)
  31.     Thread.Sleep(5)
  32. Next i
  33.  
  34. End Sub
Sep 23 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.