borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (DataGridView remove CurrentRow header triangle) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : Checking account nr
Poster Message
Fatboy58
Level: Protégé

Registered: 14-01-2008
Posts: 4

icon Checking account nr

Hi,

I have this code to check if a foreign account number is a valid number..
Ik works ......but if there is a leading 0 in the part of the 7 numbers  

it doesn't work like it should .

Dim BankNr As String, Nr As Double, Rest As Integer
        'First 3 numbers
        Dim BankNr1 As Integer = Integer.Parse(TextBox_Bank1.Text)
        '7 numbers
        Dim BankNr3 As Integer = Integer.Parse(TextBox_Bank3.Text)
        '2 Last numbers
        Dim BankNr2 As Integer = Integer.Parse(TextBox_Bank2.Text)

        BankNr = BankNr1 & "-" & BankNr2 & "-" & BankNr3

        If Not BankNr Like "###-#######-##" Then
            MsgBox("Fout formaat.")
            TextBox_Bank1.Text = ""
            TextBox_Bank2.Text = ""
            TextBox_Bank3.Text = ""
            TextBox_Bank1.Focus()
            Exit Sub

        End If

        Nr = BankNr1 & BankNr2
        Rest = Nr - 97 * Int(Nr / 97)
        If Rest = 0 Then Rest = 97

        If Rest = CInt(BankNr3) Then
            MsgBox("Bank account nr OK.")
            TextBox_Bank1.Text = ""
            TextBox_Bank2.Text = ""
            TextBox_Bank3.Text = ""
            TextBox_Bank1.Focus()
        Else
            MsgBox(”Account number wrong.")
            TextBox_Bank1.Text = ""
            TextBox_Bank2.Text = ""
            TextBox_Bank3.Text = ""
        End If
        TextBox_Bank1.Focus()

21-01-2008 at 10:24 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB.Net : Checking account nr
Next Topic (DataGridView remove CurrentRow header triangle) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2008 Andrea Tincaniborder