I try to translate a VB6 proc to c# and can't !! (I'm a C# beginner)
I have troubles with the variables types and the translation from the VB6 "&" to the C# "||"
Could an expert help me
Here comes the original VB6 code and my "translation"
The original VB6 proc
Private Sub GetStatusBits() Dim Digit As Integer Dim nSpO2_StatusBit(7) As Integer 'used for DF1 also im nSpO2_Status As Integer 'Use for DF1 also Dim nStat2 As Integer 'CONVERT SPO2 STATUS BYTE TO BINARY BYTE ARRAY For Digit = 7 To 0 Step -1 If (nSpO2_Status And (2 ^ Digit)) Then nSpO2_StatusBit(Digit) = 1 Else nSpO2_StatusBit(Digit) = 0 End If If (nStat2 And (2 ^ Digit)) Then nStat2Bit(Digit) = 1 Else nStat2Bit(Digit) = 0 End If Next DigitEnd Sub
Hi,
Please explain the error and problems, but what i have conceived is as following:
First of all you have not declared nSpO2_StatusBit in your c# code.
Secondly in VB nSpO2_StatusBit(7) means you have 8 element in array from 0 to 7. On the other hand you have only 7 elements in c# from 0 to 6.
Thanks
kaufmed
Be sure to make the change that IJZ mentioned. Change line 4 to: