473,406 Members | 2,849 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Byte is not a member of Integer

Public Shared adc_value As word_byte
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class

pmsg(2) = CChar(adc_value.word16.high_byte)

I get the following error "high_byte is not a member of Integer" How
can i fix this

Sep 10 '07 #1
11 2201
What is word16 ? Is it an integer rather than a byte_low_hi ?

---
Patrice

"cmdolcet69" <co************@hotmail.coma écrit dans le message de news:
11**********************@k79g2000hse.googlegroups. com...
Public Shared adc_value As word_byte
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class

pmsg(2) = CChar(adc_value.word16.high_byte)

I get the following error "high_byte is not a member of Integer" How
can i fix this

Sep 10 '07 #2
On Sep 10, 10:11 am, "Patrice" <http://www.chez.com/scribe/wrote:
What is word16 ? Is it an integer rather than a byte_low_hi ?

---
Patrice

"cmdolcet69" <colin_dolce...@hotmail.coma écrit dans le message de news:
1189433061.001020.262...@k79g2000hse.googlegroups. com...
Public Shared adc_value As word_byte
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
pmsg(2) = CChar(adc_value.word16.high_byte)
I get the following error "high_byte is not a member of Integer" How
can i fix this- Hide quoted text -

- Show quoted text -

These are all my declarations:

Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM

' Global Union Variables:
Public Shared crc_value As word_byte ' system crc value
Public Shared adc_value As word_byte ' adc value read from
table
Public Shared location_value As word_byte ' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} ' crc buffer
Public Shared tsize As Integer

Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
Public Structure word_byte
Public word16 As Integer
Public byte8 As byte_low_hi
End Structure
'Code Constants
'#Const BMS = True ' this represents the binary
message start byte, value 0x2A
'#Const PASSWD = True ' this represents the factory
pass code, value 11548d
'#Const POLY = True ' the polynomial used in the CRC
algorithm
Public Const BMS As Char = "*"c
Public Const PASSWD As Integer = &H2D1C
Public Const POLY As Integer = &H8005

Sep 10 '07 #3
On 10 Sep, 15:16, cmdolcet69 <colin_dolce...@hotmail.comwrote:
On Sep 10, 10:11 am, "Patrice" <http://www.chez.com/scribe/wrote:
What is word16 ? Is it an integer rather than a byte_low_hi ?
---
Patrice
"cmdolcet69" <colin_dolce...@hotmail.coma écrit dans le message de news:
1189433061.001020.262...@k79g2000hse.googlegroups. com...
Public Shared adc_value As word_byte
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
pmsg(2) = CChar(adc_value.word16.high_byte)
I get the following error "high_byte is not a member of Integer" How
can i fix this- Hide quoted text -
- Show quoted text -

These are all my declarations:

Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM

' Global Union Variables:
Public Shared crc_value As word_byte ' system crc value
Public Shared adc_value As word_byte ' adc value read from
table
Public Shared location_value As word_byte ' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} ' crc buffer
Public Shared tsize As Integer

Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class

Public Structure word_byte
Public word16 As Integer <-- type of Integer
Public byte8 As byte_low_hi
End Structure
'Code Constants
'#Const BMS = True ' this represents the binary
message start byte, value 0x2A
'#Const PASSWD = True ' this represents the factory
pass code, value 11548d
'#Const POLY = True ' the polynomial used in the CRC
algorithm

Public Const BMS As Char = "*"c
Public Const PASSWD As Integer = &H2D1C
Public Const POLY As Integer = &H8005
Well, there you go:

word16 is an Integer (4 bytes) rather than just a byte. You need to
cast it to the correct type.

Sep 10 '07 #4
On Sep 10, 11:14 am, Phillip Taylor <Phillip.Ross.Tay...@gmail.com>
wrote:
On 10 Sep, 15:16, cmdolcet69 <colin_dolce...@hotmail.comwrote:
On Sep 10, 10:11 am, "Patrice" <http://www.chez.com/scribe/wrote:
What is word16 ? Is it an integer rather than a byte_low_hi ?
---
Patrice
"cmdolcet69" <colin_dolce...@hotmail.coma écrit dans le message de news:
1189433061.001020.262...@k79g2000hse.googlegroups. com...
Public Shared adc_value As word_byte
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
pmsg(2) = CChar(adc_value.word16.high_byte)
I get the following error "high_byte is not a member of Integer" How
can i fix this- Hide quoted text -
- Show quoted text -
These are all my declarations:
Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM
' Global Union Variables:
Public Shared crc_value As word_byte ' system crc value
Public Shared adc_value As word_byte ' adc value read from
table
Public Shared location_value As word_byte ' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} ' crc buffer
Public Shared tsize As Integer
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
Public Structure word_byte

Public word16 As Integer <-- type of Integer
Public byte8 As byte_low_hi
End Structure
'Code Constants
'#Const BMS = True ' this represents the binary
message start byte, value 0x2A
'#Const PASSWD = True ' this represents the factory
pass code, value 11548d
'#Const POLY = True ' the polynomial used in the CRC
algorithm
Public Const BMS As Char = "*"c
Public Const PASSWD As Integer = &H2D1C
Public Const POLY As Integer = &H8005

Well, there you go:

word16 is an Integer (4 bytes) rather than just a byte. You need to
cast it to the correct type.- Hide quoted text -

- Show quoted text -
How do i cast it to the correct type?

Sep 10 '07 #5
"cmdolcet69" <co************@hotmail.comschrieb
On Sep 10, 10:11 am, "Patrice" <http://www.chez.com/scribe/wrote:
What is word16 ? Is it an integer rather than a byte_low_hi ?

---
Patrice

"cmdolcet69" <colin_dolce...@hotmail.coma écrit dans le message
de news: 1189433061.001020.262...@k79g2000hse.googlegroups. com...
Public Shared adc_value As word_byte
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
pmsg(2) = CChar(adc_value.word16.high_byte)
I get the following error "high_byte is not a member of Integer"
How can i fix this
It depends on what you want to do. You are trying to access a member that
does not exist. As the message says, "high_byte is not a member of Integer",
so you can not access it. Anyway it's confusing because word16 pretends to
be a 16-Bit integer, but it is declared as a 32 bit integer (Integer is
synonym for Int32), so either I would rename it to word32 or declare it as
Int16 (synonym for Short).

These are all my declarations:

Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM

' Global Union Variables:
Public Shared crc_value As word_byte ' system crc value
Public Shared adc_value As word_byte ' adc value read from
table
Public Shared location_value As word_byte ' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} ' crc buffer
Public Shared tsize As Integer

Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
Public Structure word_byte
Public word16 As Integer
Public byte8 As byte_low_hi
End Structure
'Code Constants
'#Const BMS = True ' this represents the binary
message start byte, value 0x2A
'#Const PASSWD = True ' this represents the factory
pass code, value 11548d
'#Const POLY = True ' the polynomial used in the CRC
algorithm
Public Const BMS As Char = "*"c
Public Const PASSWD As Integer = &H2D1C
Public Const POLY As Integer = &H8005

Armin

Sep 10 '07 #6
On Sep 10, 11:47 am, "Armin Zingler" <az.nos...@freenet.dewrote:
"cmdolcet69" <colin_dolce...@hotmail.comschrieb
On Sep 10, 10:11 am, "Patrice" <http://www.chez.com/scribe/wrote:


What is word16 ? Is it an integer rather than a byte_low_hi ?
---
Patrice
"cmdolcet69" <colin_dolce...@hotmail.coma écrit dans le message
denews: 1189433061.001020.262__BEGIN_MASK_n#9g02mG7!__..._ _**********************@k79g2000hse.googlegroups.c om...
Public Shared adc_value As word_byte
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
pmsg(2) = CChar(adc_value.word16.high_byte)
I get the following error "high_byte is not a member of Integer"
How can i fix this

It depends on what you want to do. You are trying to access a member that
does not exist. As the message says, "high_byte is not a member of Integer",
so you can not access it. Anyway it's confusing because word16 pretends to
be a 16-Bit integer, but it is declared as a 32 bit integer (Integer is
synonym for Int32), so either I would rename it to word32 or declare it as
Int16 (synonym for Short).


These are all my declarations:
Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM
' Global Union Variables:
Public Shared crc_value As word_byte ' system crc value
Public Shared adc_value As word_byte ' adc value read from
table
Public Shared location_value As word_byte ' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} ' crc buffer
Public Shared tsize As Integer
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
Public Structure word_byte
Public word16 As Integer
Public byte8 As byte_low_hi
End Structure
'Code Constants
'#Const BMS = True ' this represents the binary
message start byte, value 0x2A
'#Const PASSWD = True ' this represents the factory
pass code, value 11548d
'#Const POLY = True ' the polynomial used in the CRC
algorithm
Public Const BMS As Char = "*"c
Public Const PASSWD As Integer = &H2D1C
Public Const POLY As Integer = &H8005

Armin- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -
If i were to include all the code and give you a little bakground as
to what i wnat to do would you be able to help?

Sep 10 '07 #7
cmdolcet69,

It looks like you need to take a programming course and/or a Visual Basic
course.

Kerry Moorman
"cmdolcet69" wrote:
>
How do i cast it to the correct type?

Sep 10 '07 #8
On Sep 10, 12:06 pm, Kerry Moorman
<KerryMoor...@discussions.microsoft.comwrote:
cmdolcet69,

It looks like you need to take a programming course and/or a Visual Basic
course.

Kerry Moorman

"cmdolcet69" wrote:
How do i cast it to the correct type?- Hide quoted text -

- Show quoted text -
Im a little confused with the data type structure, This would be the
first time i have ever implemented into a micro. My other skills are
strong.

Sep 10 '07 #9
So word16 is an integer. high_byte is a member of byte_low_hi. So
word16.high_byte is something that doesn't exists.

I'm not sure how you would like to approach this :
- you could declare word16 as an integer (or short for a 16 bit value ???)
and extract the parts as needed
- you could declare word16 as a byte_low_hi and compute the corresponding 16
bit value as needed
- you could perhaps even declare a union (that is two structure that shares
the same underlying memroy area to access this a 16 bit value or as two
bytes depending on your needs; not remember to have tried this with .NET)

Another option would be to explain what you are trying to do in case somone
would suggest another simpler approach.

--
Patrice

"cmdolcet69" <co************@hotmail.coma écrit dans le message de news:
11*********************@g4g2000hsf.googlegroups.co m...
On Sep 10, 10:11 am, "Patrice" <http://www.chez.com/scribe/wrote:
What is word16 ? Is it an integer rather than a byte_low_hi ?

---
Patrice

"cmdolcet69" <colin_dolce...@hotmail.coma écrit dans le message de news:
1189433061.001020.262...@k79g2000hse.googlegroups. com...
Public Shared adc_value As word_byte
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
pmsg(2) = CChar(adc_value.word16.high_byte)
I get the following error "high_byte is not a member of Integer" How
can i fix this- Hide quoted text -

- Show quoted text -

These are all my declarations:

Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM

' Global Union Variables:
Public Shared crc_value As word_byte ' system crc value
Public Shared adc_value As word_byte ' adc value read from
table
Public Shared location_value As word_byte ' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} ' crc buffer
Public Shared tsize As Integer

Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
Public Structure word_byte
Public word16 As Integer
Public byte8 As byte_low_hi
End Structure
'Code Constants
'#Const BMS = True ' this represents the binary
message start byte, value 0x2A
'#Const PASSWD = True ' this represents the factory
pass code, value 11548d
'#Const POLY = True ' the polynomial used in the CRC
algorithm
Public Const BMS As Char = "*"c
Public Const PASSWD As Integer = &H2D1C
Public Const POLY As Integer = &H8005
Sep 10 '07 #10
"cmdolcet69" <co************@hotmail.comschrieb
If i were to include all the code and give you a little bakground as
to what i wnat to do would you be able to help?
I'm afraid, due to a lack of time, currently probably not.
Armin

Sep 10 '07 #11
On Sep 10, 7:30 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"cmdolcet69" <colin_dolce...@hotmail.comschrieb
If i were to include all the code and give you a little bakground as
to what i wnat to do would you be able to help?

I'm afraid, due to a lack of time, currently probably not.

Armin
Just do this then if your running out of time:

msg(2) = CChar(Convert.ToByte(adc_value.word16))

Sep 11 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Zulik | last post by:
Hello, I might have a bad day today but I have a byte buffer holding binary numbers. Now, I want to convert this to byte buffer with hex numbers. Is there any elegant way of doing that? Some...
1
by: | last post by:
When I execute the following (with an OleDBDataAdapter), wanting to add a row to a visual foxpro table: myrow= datasetTarget.Tables(0).NewRow 'fill all columns here like.. row(i)= myvalue '...
43
by: Bill Cunningham | last post by:
I've been reading the C standard online and I'm puzzled as to what multibyte chars are. Wide chars I believe would be characters for languages such as cantonese or Japanese. I know the ASCII...
4
by: Shashi | last post by:
Can somebody explain how the byte alignment for structures work, taking the following example and considering: byte of 1 Byte word of 2 Bytes dword of 4 Bytes typedef struct { byte a; word...
5
by: Robin Tucker | last post by:
I need to marshal an IntPtr (which I've got from GlobalLock of an HGLOBAL) into a byte array. I know the size of the array required and I've got a pointer to the blob, but I can't see how to copy...
9
by: Charles Law | last post by:
Suppose I have a structure Private Structure MyStruct Dim el1 As Byte Dim el2 As Int16 Dim el3 As Byte End Structure I want to convert this into a byte array where
6
by: Dennis | last post by:
I was trying to determine the fastest way to build a byte array from components where the size of the individual components varied depending on the user's input. I tried three classes I built: (1)...
24
by: Frederick Gotham | last post by:
There is a thread currently active on this newsgroup entitled: "how to calculate the difference between 2 addresses ?" The thread deals with calculating the distance, in bytes, between two...
77
by: borophyll | last post by:
As I read it, C99 states that a byte is an: "addressable unit of data storage large enough to hold any member of the basic character set of the execution environment" (3.6) and that a byte...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.