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

Exception from HRESULT: 0x800A017C (CTL_E_INVALIDPROPERTYVALUE)

P: n/a
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

Sep 22 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a

"cmdolcet69" <co************@hotmail.comha scritto nel messaggio
news:11**********************@n39g2000hsh.googlegr oups.com...
>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
Sep 22 '07 #2

P: n/a
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?

"cmdolcet69" wrote:
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

Sep 22 '07 #3

P: n/a
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:

co***************@variables.at_all

--
Newbie Coder
(It's just a name)

"cmdolcet69" <co************@hotmail.comwrote in message
news:11**********************@n39g2000hsh.googlegr oups.com...
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

Sep 22 '07 #4

P: n/a
On Sep 22, 5:42 pm, Family Tree Mike
<FamilyTreeM...@discussions.microsoft.comwrote:
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?

"cmdolcet69" wrote:
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- Hide quoted text -

- 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.
Sep 23 '07 #5

P: n/a
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

Sep 23 '07 #6

P: n/a
On Sep 22, 9:46 pm, Family Tree Mike
<FamilyTreeM...@discussions.microsoft.comwrote:
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!

Sep 23 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.