Creating a ATM program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nabman
    New Member
    • Nov 2007
    • 7

    Creating a ATM program

    OK, I am creating a program where I have two forms, the login and main form. On the login form the user will be prompted to enter their account number and password. This info is read from a file. Upon a successful login the main form will pop up with options to perform from there. I got it to where it will continue to the main form, but it gives me a error message every time. I am thinking I have the validation in the wrong spot. I'm sure I am just forgetting something. Also I was wanting to perform some type of encryption so no one could just open up the txt file and see the passwords in plain-text, I am completely lost when it comes to ideas on this one. And finally, once the users has entered in an account number/password three time I want it to terminate the program.
    [CODE=vbnet]Public Class frmLogin
    'Error message, how can I get rid of it
    'Encrypt password, read it backwards
    Dim sr As IO.StreamReader
    Dim Acctnumber, password As String
    Private Sub frmBankATM_Load (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
    Me.Text = "RBD Bank Account Login"
    End Sub

    Sub OpenFile()
    sr = IO.File.OpenTex t("customers.tx t")
    End Sub
    Sub CloseFile()
    sr.Close()
    End Sub

    Private Sub btnSubmit_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSubmit.Click
    OpenFile()
    Do While sr.Peek <> -1
    Acctnumber = sr.ReadLine
    password = sr.ReadLine
    If txtaccount.Text = Acctnumber And txtpassword.Tex t = password Then
    frmMainboard.Sh ow()
    End If
    Loop
    OpenFile()
    If sr.Peek <> -1 Then
    MsgBox("The Account Number and/or Password Combination is Wrong", MsgBoxStyle.Cri tical, "Invalid Password")
    Exit Sub
    End If
    CloseFile()
    End Sub
    End Class[/CODE]
    Last edited by Killer42; Nov 30 '07, 02:10 AM.
  • nabman
    New Member
    • Nov 2007
    • 7

    #2
    I got a little more done, still need a validation.
    [CODE=vbnet]
    Public Class frmLogin
    'Error message
    'Only three Login attemps
    Dim sr As IO.StreamReader
    Dim Acctnumber, password As String
    Private Sub frmBankATM_Load (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
    Me.Text = "RBD Bank Account Login"
    End Sub

    Sub OpenFile()
    sr = IO.File.OpenTex t("customers.tx t")
    End Sub
    Sub CloseFile()
    sr.Close()
    End Sub

    Private Sub btnSubmit_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSubmit.Click

    OpenFile()
    Do While sr.Peek <> -1
    Acctnumber = sr.ReadLine
    password = sr.ReadLine
    If txtaccount.Text = Acctnumber And txtpassword.Tex t = Reverse(passwor d) Then
    frmMainboard.Sh ow()
    End If
    Loop
    End Sub

    Function Reverse(ByVal info As String) As String
    Dim a, b As Integer
    Dim temp As Integer
    Dim password As String = ""
    a = info.Length
    For b = a - 1 To 0 Step -1
    temp &= info.Substring( b, 1)
    Next
    Return temp
    End Function
    End Class
    [/CODE]
    Last edited by Killer42; Nov 30 '07, 02:15 AM.

    Comment

    Working...