Click here to Skip to main content
15,916,463 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: byte array to string Pin
jkirkerx21-Jun-12 20:31
professionaljkirkerx21-Jun-12 20:31 
I'll give that a try Friday

For some reason, bits that is passed into the function, is 1 too long, in other words, the length is 1 bit bigger than it's suppose to be.

So I did a -2 on the length in the loop instead of -1, and the value is now correct. It's sloppy, just a band-aid, but overall in the end, the return value is correct.

I would like to fix it correctly, so let me give your fix a test in the morning.
Good job on isolating it down to that function, and thanks for helping me out Sandeep.

Private Function BitStringToInteger(ByVal bits As String) As Integer

        Dim converted As Integer = 0

        For i As Integer = 0 To bits.Length - 2 '<- chopped it down 1 more
            converted = (converted << 1) + If(bits(i) = "1", 1, 0)
        Next

        Return converted

    End Function

AnswerRe: byte array to string Pin
Nick Otten21-Jun-12 2:43
Nick Otten21-Jun-12 2:43 
QuestionPassword Storage Class Pin
flinchy318-Jun-12 4:31
flinchy318-Jun-12 4:31 
AnswerRe: Password Storage Class Pin
908236518-Jun-12 6:26
908236518-Jun-12 6:26 
GeneralRe: Password Storage Class Pin
flinchy318-Jun-12 7:28
flinchy318-Jun-12 7:28 
GeneralRe: Password Storage Class Pin
908236519-Jun-12 5:29
908236519-Jun-12 5:29 
GeneralRe: Password Storage Class Pin
flinchy321-Jun-12 4:17
flinchy321-Jun-12 4:17 
GeneralRe: Password Storage Class Pin
908236521-Jun-12 5:30
908236521-Jun-12 5:30 
GeneralRe: Password Storage Class Pin
908236522-Jun-12 10:39
908236522-Jun-12 10:39 
GeneralRe: Password Storage Class Pin
flinchy328-Jun-12 1:20
flinchy328-Jun-12 1:20 
GeneralRe: Password Storage Class Pin
flinchy328-Jun-12 1:25
flinchy328-Jun-12 1:25 
QuestionHow to get session state in VB.NET desktop app Pin
ilgrongo18-Jun-12 3:38
ilgrongo18-Jun-12 3:38 
AnswerRe: How to get session state in VB.NET desktop app Pin
Dave Kreskowiak18-Jun-12 10:53
mveDave Kreskowiak18-Jun-12 10:53 
GeneralRe: How to get session state in VB.NET desktop app Pin
ilgrongo18-Jun-12 13:04
ilgrongo18-Jun-12 13:04 
GeneralRe: How to get session state in VB.NET desktop app Pin
Dave Kreskowiak18-Jun-12 14:51
mveDave Kreskowiak18-Jun-12 14:51 
GeneralRe: How to get session state in VB.NET desktop app Pin
ilgrongo18-Jun-12 19:52
ilgrongo18-Jun-12 19:52 
QuestionWindows 7 Lock app Pin
flinchy316-Jun-12 2:42
flinchy316-Jun-12 2:42 
AnswerRe: Windows 7 Lock app Pin
Dave Kreskowiak16-Jun-12 3:42
mveDave Kreskowiak16-Jun-12 3:42 
GeneralRe: Windows 7 Lock app Pin
flinchy316-Jun-12 16:21
flinchy316-Jun-12 16:21 
GeneralRe: Windows 7 Lock app Pin
Dave Kreskowiak16-Jun-12 17:26
mveDave Kreskowiak16-Jun-12 17:26 
AnswerRe: Windows 7 Lock app [fixed] Pin
Eddy Vluggen16-Jun-12 10:38
professionalEddy Vluggen16-Jun-12 10:38 
GeneralRe: Windows 7 Lock app Pin
Richard Andrew x6416-Jun-12 10:57
professionalRichard Andrew x6416-Jun-12 10:57 
GeneralRe: Windows 7 Lock app Pin
Eddy Vluggen16-Jun-12 11:11
professionalEddy Vluggen16-Jun-12 11:11 
GeneralRe: Windows 7 Lock app [fixed] Pin
flinchy316-Jun-12 16:48
flinchy316-Jun-12 16:48 
AnswerRe: Windows 7 Lock app [fixed] Pin
Eddy Vluggen17-Jun-12 0:06
professionalEddy Vluggen17-Jun-12 0:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.