
A Binary Data Type Question
1. In a VB4.0 application, I read status data from a machine. A
(third party) control (called WinSECS from FastTech) is used to read
the status. As far as I can tell, the variable is typed as binary. [I
don't understand the details of this control well. It is possible
that I could be wrong on this.]
2. The application has the following statement:
If (gwsSecsTransaction.Secondary.Item("EAC") = 0) Then
3. When I run with a simulator, the data byte for EAC has 32 as the
value. (The simulator sends this value.) This does NOT cause the above
statement any problems.
4. When I run with the actual machine, the data byte for EAC has 02 as
the value. I get a Type Mismatch in the above statement.
5. I am wondering whether someone can explain what is going on. I
noticed that binary values are stored as Byte data type. Why should
Case (a) have a problem but not Case (b) (below) ?
(a) Comparing Hex 02 with 0
(b) Comparing Hex 32 with 0
6. Is the constant 0 in the If statement binary, integer, or string ?
7. The following test segement does not get a Type Mismatch error:
Dim bytTest as Byte
bytTest = 2
If (bytTest = 2) Then
End If
8. I do realize that the following conversion functions are available:
Val
Asc
CInt
9. If possible, please e-mail copies of replies to
10. Thanks.
Shaker
comparing Hex 02 with 0 cause a problem but not