CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Sep 2002
    Location
    Israel
    Posts
    396

    Need help to convert this function from VB to VB.Net

    Hi
    I have this function that i need your help to convert it to work on VB.Net 2008 code:
    Code:
    Function BdikatTakinutMisparZeut(ByVal IDNumber As Object) As Integer        
            Dim SumAll As Byte, SumTemp As Byte, index As Byte
            Select Case True
                Case IsNothing(IDNumber) : BdikatTakinutMisparZeut = 1
                Case IDNumber = "" : BdikatTakinutMisparZeut = 2
                Case Not IsNumeric(IDNumber) : BdikatTakinutMisparZeut = 3
                Case Len(IDNumber) > 9 : BdikatTakinutMisparZeut = 4
                Case Else
                    IDNumber = String$(9 - Len(IDNumber), "0") & IDNumber
                    For index = 1 To 8
                        SumTemp = Mid(IDNumber, index, 1) * Mid("12121212", index, 1)
                        SumAll = SumAll + IIf(SumTemp < 10, SumTemp, 1 + Right(SumTemp, 1))
                    Next index
                    BdikatTakinutMisparZeut = Right(100 - SumAll, 1) = Right(IDNumber, 1)
            End Select   
        End Function
    Basically i need the help with this code String$ and Right
    Many thanks
    Last edited by leeshadmi; December 28th, 2010 at 07:44 AM. Reason: forgot something

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured