Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ===========Menu===========
- Public Class MainF
- Private Sub MainF_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load ' on form load, rate button hidden
- btnRate.Hide()
- End Sub
- Private Sub btnConverter_Click(sender As Object, e As EventArgs) Handles btnConverter.Click 'on click, form converter appears
- Converter.Show()
- End Sub
- Private Sub btnRate_Click(sender As Object, e As EventArgs) Handles btnRate.Click 'on click, form rate appears
- rate.Show()
- End Sub
- Private Sub btQuit_Click(sender As Object, e As EventArgs) Handles btnQuit.Click 'on click, closes program
- Application.Exit()
- End Sub
- Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click 'on click, form login appears
- login.Show()
- End Sub
- Private Sub btnSetting_Click(sender As Object, e As EventArgs) Handles btnSetting.Click 'on click, form settings appears
- Setting.Show()
- End Sub
- End Class
- =========End Of Menu=======
- ========Start Of Converter======
- Public Class Converter
- Dim c As Double
- Dim c2 As Double
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ' This handles the Currency Exchange
- If Not Double.TryParse(TextBox1.Text, c) Then 'If nothing has been selected in the combo boxes or in the textbox then execute code below
- MessageBox.Show("Please enter a currency to convert and an amount..")
- Exit Sub
- End If
- c = TextBox1.Text * lbp.Text ' Pound To Euro Rate
- c2 = TextBox1.Text * lbe.Text ' Euro To Pound Rate
- If cbCurrency1.SelectedIndex = 0 And cbCurrency2.SelectedIndex = 1 Then ' If Euro And Pound Is Selected Then Execute Below
- MsgBox("The Converted Money Will Be: £" & c2)
- ElseIf cbCurrency1.SelectedIndex = 1 And cbCurrency2.SelectedIndex = 0 Then ' If Pound And Euro Is Selected Then Execute Below
- MsgBox("The Converted Money Will Be: €" & c)
- ElseIf cbCurrency1.SelectedIndex = 1 And cbCurrency2.SelectedIndex = 1 Then ' If Euro And Euro Is Selected Then Execute Below
- MsgBox("Can't Convert Same Currency")
- ElseIf cbCurrency1.SelectedIndex = 0 And cbCurrency2.SelectedIndex = 0 Then ' If Pound And Pound Is Selected Then Execute Below
- MsgBox("Can't Convert Same Currency")
- End If
- End Sub
- Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress ' This makes it so only numbers can be inputted into the Amounts Textbox
- '97 - 122 = Ascii codes for simple letters
- '65 - 90 = Ascii codes for capital letters
- '48 - 57 = Ascii codes for numbers
- If Asc(e.KeyChar) <> 8 Then
- If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
- e.Handled = True
- End If
- End If
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- Me.Close() ' closes form
- End Sub
- End Class
- ======End Of Converter ========
- ======Start Of Login ==========
- Public Class login
- Private cntAttempts = 0 ' This sets the attempts to 0
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Dim User As String
- Dim Pass As String
- User = TextBox1.Text
- Pass = TextBox2.Text
- If User = "Admin" And Pass = "admin123" Then ' If Inputted User & Pass Is Correct Then Proceed With Below Code.
- MsgBox("Admin Logged In.")
- MainF.btnLogin.Visible = False
- MainF.btnRate.Visible = True
- Me.Close()
- Else
- cntAttempts += 1 ' Every time incorrect details for admin login is entered, its counted and after the 3rd time it will close the program.
- MsgBox("You've entered incorrect details, You've used " & cntAttempts & " out of 3")
- If cntAttempts = 3 Then ' If user enters incorrect details 3 times then execute code below.
- MsgBox("You've entered incorrect details 3 times, you've run out of tries. Programming is now closing.", , "Attempts: " & cntAttempts)
- Me.Close()
- End If
- End If
- End Sub
- End Class
- ==== End Of Login =====
- ===== Start Of Rate Changer =====
- Public Class rate
- Private Sub btConvert2_Click(sender As Object, e As EventArgs) Handles btConvert2.Click '
- If cbCurrency3.SelectedIndex = 0 Then ' If Euro to Pound is selected then excute below code
- Converter.lbe.Text = tbAmount.Text
- MsgBox("Euro To Pound Rate Has Changed To: €1 = £" & tbAmount.Text)
- ElseIf cbCurrency3.SelectedIndex = 1 Then ' If Pound to Euro is selected then excute below code
- Converter.lbp.Text = tbAmount.Text ' this changes the label for pound on the converter form to whatever the user inputted in the rate form.
- MsgBox("Pound To Euro Rate Has Changed To: £1 = €" & tbAmount.Text)
- End If
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Me.Close() ' Closes form
- End Sub
- End Class
- ==== End Of Rate Changer ====
- === Start Of Settings ====
- Public Class Setting
- Private Sub btnBlack_Click(sender As Object, e As EventArgs) Handles btnBlack.Click 'Onclick form background changes to black and label background changes to white
- Me.BackColor = Color.Black
- rate.BackColor = Color.Black
- login.BackColor = Color.Black
- Converter.BackColor = Color.Black
- login.Label1.BackColor = Color.White
- login.Label2.BackColor = Color.White
- Label1.BackColor = Color.White
- End Sub
- Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click ' Closes form
- Me.Close()
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click 'Onclick form background changes to white and label background changes to transparent
- Me.BackColor = Color.White
- rate.BackColor = Color.White ' This changes the background colour of the rate form
- login.BackColor = Color.White
- Converter.BackColor = Color.White
- login.Label1.BackColor = Color.Transparent
- login.Label2.BackColor = Color.Transparent
- Label1.BackColor = Color.Transparent
- End Sub
- End Class
- ==== End Of Settings ====
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement