Advertisement
Guest User

Untitled

a guest
Jun 16th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.52 KB | None | 0 0
  1. ===========Menu===========
  2. Public Class MainF
  3. Private Sub MainF_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load ' on form load, rate button hidden
  4. btnRate.Hide()
  5.  
  6. End Sub
  7.  
  8. Private Sub btnConverter_Click(sender As Object, e As EventArgs) Handles btnConverter.Click 'on click, form converter appears
  9. Converter.Show()
  10. End Sub
  11.  
  12. Private Sub btnRate_Click(sender As Object, e As EventArgs) Handles btnRate.Click 'on click, form rate appears
  13. rate.Show()
  14. End Sub
  15.  
  16. Private Sub btQuit_Click(sender As Object, e As EventArgs) Handles btnQuit.Click 'on click, closes program
  17. Application.Exit()
  18. End Sub
  19.  
  20. Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click 'on click, form login appears
  21. login.Show()
  22.  
  23.  
  24.  
  25. End Sub
  26.  
  27.  
  28. Private Sub btnSetting_Click(sender As Object, e As EventArgs) Handles btnSetting.Click 'on click, form settings appears
  29. Setting.Show()
  30. End Sub
  31. End Class
  32. =========End Of Menu=======
  33.  
  34. ========Start Of Converter======
  35. Public Class Converter
  36. Dim c As Double
  37. Dim c2 As Double
  38.  
  39. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click ' This handles the Currency Exchange
  40.  
  41. 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
  42. MessageBox.Show("Please enter a currency to convert and an amount..")
  43. Exit Sub
  44. End If
  45.  
  46.  
  47.  
  48. c = TextBox1.Text * lbp.Text ' Pound To Euro Rate
  49. c2 = TextBox1.Text * lbe.Text ' Euro To Pound Rate
  50.  
  51.  
  52.  
  53. If cbCurrency1.SelectedIndex = 0 And cbCurrency2.SelectedIndex = 1 Then ' If Euro And Pound Is Selected Then Execute Below
  54. MsgBox("The Converted Money Will Be: £" & c2)
  55. ElseIf cbCurrency1.SelectedIndex = 1 And cbCurrency2.SelectedIndex = 0 Then ' If Pound And Euro Is Selected Then Execute Below
  56. MsgBox("The Converted Money Will Be: €" & c)
  57. ElseIf cbCurrency1.SelectedIndex = 1 And cbCurrency2.SelectedIndex = 1 Then ' If Euro And Euro Is Selected Then Execute Below
  58. MsgBox("Can't Convert Same Currency")
  59. ElseIf cbCurrency1.SelectedIndex = 0 And cbCurrency2.SelectedIndex = 0 Then ' If Pound And Pound Is Selected Then Execute Below
  60. MsgBox("Can't Convert Same Currency")
  61.  
  62. End If
  63.  
  64.  
  65.  
  66.  
  67. End Sub
  68. 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
  69.  
  70. '97 - 122 = Ascii codes for simple letters
  71. '65 - 90 = Ascii codes for capital letters
  72. '48 - 57 = Ascii codes for numbers
  73.  
  74. If Asc(e.KeyChar) <> 8 Then
  75.  
  76. If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
  77. e.Handled = True
  78.  
  79.  
  80. End If
  81. End If
  82.  
  83. End Sub
  84.  
  85. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  86. Me.Close() ' closes form
  87. End Sub
  88.  
  89.  
  90. End Class
  91. ======End Of Converter ========
  92.  
  93.  
  94. ======Start Of Login ==========
  95. Public Class login
  96. Private cntAttempts = 0 ' This sets the attempts to 0
  97. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  98.  
  99. Dim User As String
  100. Dim Pass As String
  101. User = TextBox1.Text
  102. Pass = TextBox2.Text
  103.  
  104. If User = "Admin" And Pass = "admin123" Then ' If Inputted User & Pass Is Correct Then Proceed With Below Code.
  105. MsgBox("Admin Logged In.")
  106. MainF.btnLogin.Visible = False
  107. MainF.btnRate.Visible = True
  108. Me.Close()
  109. Else
  110.  
  111.  
  112. cntAttempts += 1 ' Every time incorrect details for admin login is entered, its counted and after the 3rd time it will close the program.
  113. MsgBox("You've entered incorrect details, You've used " & cntAttempts & " out of 3")
  114. If cntAttempts = 3 Then ' If user enters incorrect details 3 times then execute code below.
  115. MsgBox("You've entered incorrect details 3 times, you've run out of tries. Programming is now closing.", , "Attempts: " & cntAttempts)
  116. Me.Close()
  117.  
  118.  
  119. End If
  120. End If
  121. End Sub
  122. End Class
  123.  
  124. ==== End Of Login =====
  125.  
  126. ===== Start Of Rate Changer =====
  127. Public Class rate
  128.  
  129. Private Sub btConvert2_Click(sender As Object, e As EventArgs) Handles btConvert2.Click '
  130. If cbCurrency3.SelectedIndex = 0 Then ' If Euro to Pound is selected then excute below code
  131. Converter.lbe.Text = tbAmount.Text
  132. MsgBox("Euro To Pound Rate Has Changed To: €1 = £" & tbAmount.Text)
  133. ElseIf cbCurrency3.SelectedIndex = 1 Then ' If Pound to Euro is selected then excute below code
  134.  
  135. Converter.lbp.Text = tbAmount.Text ' this changes the label for pound on the converter form to whatever the user inputted in the rate form.
  136. MsgBox("Pound To Euro Rate Has Changed To: £1 = €" & tbAmount.Text)
  137. End If
  138. End Sub
  139.  
  140. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  141. Me.Close() ' Closes form
  142. End Sub
  143. End Class
  144.  
  145. ==== End Of Rate Changer ====
  146.  
  147. === Start Of Settings ====
  148. Public Class Setting
  149.  
  150. 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
  151. Me.BackColor = Color.Black
  152. rate.BackColor = Color.Black
  153. login.BackColor = Color.Black
  154. Converter.BackColor = Color.Black
  155. login.Label1.BackColor = Color.White
  156. login.Label2.BackColor = Color.White
  157. Label1.BackColor = Color.White
  158. End Sub
  159.  
  160. Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click ' Closes form
  161. Me.Close()
  162. End Sub
  163.  
  164. 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
  165. Me.BackColor = Color.White
  166. rate.BackColor = Color.White ' This changes the background colour of the rate form
  167. login.BackColor = Color.White
  168. Converter.BackColor = Color.White
  169. login.Label1.BackColor = Color.Transparent
  170. login.Label2.BackColor = Color.Transparent
  171. Label1.BackColor = Color.Transparent
  172.  
  173. End Sub
  174. End Class
  175.  
  176. ==== End Of Settings ====
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement