Exception from HRESULT: 0x800A017C (CTL_E_INVALIDPROPERTYVALUE)

C

cmdolcet69

I get tis error message as soon as i a step into the comm1.Output =
Packet(i) line of code.

Below is my code could someone run this and see if they get the smae
message?

Public Sub GetIndicator_Info()
Dim Len As Byte = 6
Dim Cmd As Byte = 7
Dim loPass_byte As Byte = 28
Dim hiPass_byte As Byte = 45
Dim CRClo_byte As Byte = 48
Dim CRChi_byte As Byte = 130
Dim i As Integer


Dim Packet(5) As Byte
Packet(0) = 6
Packet(1) = 7
Packet(2) = 28
Packet(3) = 45
Packet(4) = 48
Packet(5) = 130

For i = 0 To 5
comm1.Output = Packet(i)
Thread.Sleep(5)
Next i

End Sub
 
G

Giovanni Dicanio

I get tis error message as soon as i a step into the comm1.Output =
Packet(i) line of code.
[...]

Dim Packet(5) As Byte
[...]

For i = 0 To 5
comm1.Output = Packet(i)

I've not tested this and I'm very newbie to VB.Net, but would it be possible
that the Output property is not of type Byte?
Maybe you should convert from Byte (Packet(i)) to the type of the Output
property?

G
 
G

Guest

First, your sub still won't compile as was pointed out in the other threads.
You have not shown the declaration of comm1.

I suspect from before, it is a MSCOMM object.

Won't this class "System.IO.Ports.SerialPort" work?
 
N

Newbie Coder

Colin,

Your naming of variables leaves much to be desired

Soon you will come up against your variable names being reserved keywords

Spoof your e-mail unless you like SPAM

Example:

(e-mail address removed)_all
 
C

cmdolcet69

First, your sub still won't compile as was pointed out in the other threads.
You have not shown the declaration of comm1.

I suspect from before, it is a MSCOMM object.

Won't this class "System.IO.Ports.SerialPort" work?










- Show quoted text -

No this namespace wont work because it not a valild namespace in vb
2003 with ,net 1.1.
That is why i use the mscomm reference and call my object.

Here the delcaration of the comm1
Imports MSCommLib
Private comm1 As New MSComm

Public Sub SetupCOM(ByVal comPort As Integer)
''initialize the com if it has not been already
'If IsNothing(comm1) Then
' comm1 = New MSComm
'End If
''set the properties of the com port
'comm1.CommPort = comPort
'comm1.Settings = "57600,n,8,1"
''open the port and clear the buffer if it is not alread open
(which it better not be)
'If Not comm1.PortOpen Then
' comm1.PortOpen = True
' comm1.InBufferCount = 0
' System.Threading.Thread.CurrentThread.Sleep(100)
'End If

end sub.


I think this isn;t working because when i call my comm1.output it
doesn;t work like the serial com in vb 2005.
In vb 2005 there is not write method for this class.

If anyone has any ideas please let me know.
 
G

Guest

How about trying the following, as taken roughly from MSDN:

For i = 0 To 5
comm1.Output = Chr(Packet(i))

' Wait for the data to come back to the serial port.
' Only you would know if the device will respond back for each
byte.
Do
Buffer = Buffer & MSComm1.Input
Loop Until InStr(Buffer, "OK" & vbCrLf)

' unclear if this is still necessary...
' Thread.Sleep(5)
Next i
 
C

cmdolcet69

How about trying the following, as taken roughly from MSDN:

For i = 0 To 5
comm1.Output = Chr(Packet(i))

' Wait for the data to come back to the serial port.
' Only you would know if the device will respond back for each
byte.
Do
Buffer = Buffer & MSComm1.Input
Loop Until InStr(Buffer, "OK" & vbCrLf)

' unclear if this is still necessary...
' Thread.Sleep(5)
Next i

The packet needs to be a byte so that the micro will recognize the
info being sent. I will try this out and see, and then get back!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top