暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

計算機.vb 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. Imports System.IO
  2. Imports System.Text
  3. Public Class 計算機
  4. Dim MACKK As String 'MAC碼
  5. Dim diskId As String '數字ID
  6. Dim diskSerialNumber As String '硬碟序列
  7. Dim diskModel As String '磁盘型態
  8. Dim IP公, IP測1, IP測2, 內網線路, 可登入 As Boolean
  9. Private ReadOnly 對話框(15) As String
  10. Private Sub 初始化系統語言()
  11. If File.Exists(Application.StartupPath + "\LANGUAGE_FILE.csv") Then
  12. Dim filereader = My.Computer.FileSystem.OpenTextFileReader(Application.StartupPath + "\LANGUAGE_FILE.csv", System.Text.Encoding.Default)
  13. Dim line As String = filereader.ReadLine()
  14. While Not (line Is Nothing)
  15. line = filereader.ReadLine()
  16. If line <> Nothing Then
  17. line = line.Replace("""", "") : Dim separator As String = "-" : Dim result() As String = line.Split(separator)
  18. If result.Count > 4 Then
  19. Dim key As String = result(0).ToString() & "-" & result(1).ToString() & "-" & result(2).ToString()
  20. Dim value As String = result(3).ToString()
  21. For i As Integer = 4 To result.Count - 1 : value += "-" & result(i) : Next
  22. If value.EndsWith(",") Then : value = value.Substring(0, value.Length - 1) : End If : 系統語言字典.Add(key, value)
  23. Else
  24. Dim key As String = result(0).ToString() & "-" & result(1).ToString() & "-" & result(2).ToString()
  25. Dim value As String = result(3).ToString()
  26. If value.EndsWith(",") Then : value = value.Substring(0, value.Length - 1) : End If : 系統語言字典.Add(key, value)
  27. End If
  28. End If
  29. End While
  30. End If
  31. End Sub
  32. Private Sub 語言轉換讀取()
  33. End Sub
  34. Private Sub IP比對()
  35. If SQL_連線狀態模組3.ConnectTest3("192.168.1.63,2433") = True Then
  36. '---主伺服器導通-------------------------------------------
  37. IP公 = True : IP測1 = True : IP測2 = True : 伺服器區域_cb.Text = "公司內網" : 公司線路_rb.Checked = True : 測試線路_rb.Checked = False : 內網線路 = True
  38. 刷卡登入_ch.Checked = True
  39. Else
  40. Dim Str As String = Application.StartupPath
  41. If File.Exists(Str + "\HXLINE.txt") Then
  42. Dim filereader = My.Computer.FileSystem.OpenTextFileReader(Str + "\HXLINE.txt", System.Text.Encoding.Default)
  43. Dim Text As String = "" : Dim line As String = filereader.ReadLine()
  44. While Not (line Is Nothing) : Text = Text & line & vbCrLf : line = filereader.ReadLine() : End While : filereader.Close()
  45. If Strings.Left(Text, 10) = "3MBPS-LINE" Then : PA49 = "36.64.59.26,2433"
  46. ElseIf Strings.Left(Text, 11) = "20MBPS-LINE" Then : PA49 = "36.64.59.26,2433" : End If
  47. Else : 線路選擇.ShowDialog() : End If
  48. If SQL_連線狀態模組1.ConnectTest1(PA49) = True Then
  49. '---主伺服器導通-------------------------------------------
  50. IP公 = True : IP測1 = True : IP測2 = True : 伺服器區域_cb.Text = "公司雲端" : 公司線路_rb.Checked = True : 測試線路_rb.Checked = False : 內網線路 = False
  51. 刷卡登入_ch.Checked = True
  52. Else
  53. 線路選擇.ShowDialog()
  54. If PA49 = "106.1.48.106,4567" Then
  55. IP公 = True : IP測1 = True : IP測2 = True : 伺服器區域_cb.Text = "測試雲端" : 公司線路_rb.Checked = True : 測試線路_rb.Checked = False : 內網線路 = False
  56. 刷卡登入_ch.Checked = True
  57. Else
  58. IP公 = True : IP測1 = True : IP測2 = True : 伺服器區域_cb.Text = "公司雲端" : 公司線路_rb.Checked = True : 測試線路_rb.Checked = False : 內網線路 = False
  59. 刷卡登入_ch.Checked = True
  60. End If
  61. End If
  62. End If
  63. End Sub
  64. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  65. 初始化系統語言() : 後數_tb.Enabled = False : 前數_tb.Enabled = False : 算式_tb.Enabled = False
  66. Me.KeyPreview = True : Panel1.SendToBack()
  67. '-----電腦預設值------------------------------------------------------------------------------------------------------------------------------------------------------------------
  68. Dim Str As String = Application.StartupPath
  69. If File.Exists(Str + "\LANGUAGE.txt") Then
  70. Dim filereader = My.Computer.FileSystem.OpenTextFileReader(Str + "\LANGUAGE.txt", System.Text.Encoding.Default)
  71. Dim Text As String = "" : Dim line As String = filereader.ReadLine()
  72. While Not (line Is Nothing) : Text &= line : line = filereader.ReadLine() : End While : filereader.Close()
  73. If Strings.Left(Text, 4) = "CHER" Then
  74. 系統語言_cb.Text = "繁體中文" : 系統語言 = "繁體中文"
  75. ElseIf Strings.Left(Text, 4) = "Engl" Then
  76. 系統語言_cb.Text = "English" : 系統語言 = "English"
  77. ElseIf Strings.Left(Text, 4) = "Indo" Then
  78. 系統語言_cb.Text = "Indonesian" : 系統語言 = "Indonesian"
  79. End If
  80. Else
  81. Dim strDirName As String : Dim Strs As String = Application.StartupPath
  82. If File.Exists(Strs & "\LANGUAGE.txt") Then : File.Delete(Strs & "\LANGUAGE.txt") : End If
  83. strDirName = Strs & "\LANGUAGE.txt"
  84. Try
  85. Using fs As New IO.FileStream(strDirName, FileMode.Append)
  86. Using sw As New StreamWriter(fs, Encoding.Default)
  87. Dim stra As String = "CHER"
  88. sw.WriteLine(stra) '插入一整行
  89. sw.Flush()
  90. End Using
  91. End Using
  92. Catch ex As Exception : End Try
  93. 系統語言_cb.Text = "繁體中文" : 系統語言 = "繁體中文"
  94. End If
  95. IP比對()
  96. '-----電腦綁定判斷-------------------------------------------------------------------------------------------------------------------------------------------------------------
  97. PA1 = MACKK : PA2 = diskId : PA3 = diskSerialNumber : PA4 = diskModel
  98. SQL_電腦綁定()
  99. If dr.Read() Then
  100. 可登入 = True : PA50 = dr("使用者").ToString : conn.Close()
  101. Else
  102. 可登入 = False : conn.Close()
  103. End If
  104. End Sub
  105. Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 伺服器區域_cb.SelectedIndexChanged
  106. '-----------------------確認登入伺服器位置-----------------------------------------------------------------------------------------------------------------------------------------
  107. If 伺服器區域_cb.Text = "公司內網" Then
  108. If IP公 = True Then : 登入人IP = "192.168.1.63,2433" : Line通訊IP = "192.168.1.63,2433" : Line伺服器名稱 = "HX-LINE-AUTO"
  109. 登入() : 刷卡登入_ch.Checked = True : Else : MGB(對話框(11), 1) : Me.Close() : End If
  110. ElseIf 伺服器區域_cb.Text = "公司雲端" Then
  111. If IP公 = True Then : 登入人IP = PA49 : Line通訊IP = PA49 : Line伺服器名稱 = "HX-LINE-AUTO"
  112. 登入() : 刷卡登入_ch.Checked = True : Else : MGB(對話框(11), 1) : Me.Close() : End If
  113. ElseIf 伺服器區域_cb.Text = "測試雲端" Then
  114. If IP測1 = True Then : 登入人IP = "106.1.48.106,4567" : Line通訊IP = "36.64.59.26,2433" : Line伺服器名稱 = "HX-LINE-AUTO"
  115. 登入() : 刷卡登入_ch.Checked = True : Else : MGB(對話框(11), 1) : Me.Close() : End If
  116. ElseIf 伺服器區域_cb.Text = "印尼測試" Then
  117. If IP測2 = True Then : 登入人IP = "172.1.1.189,2433" : Line通訊IP = "192.168.1.63,2433" : Line伺服器名稱 = "HX-LINE-AUTO"
  118. If SQL_連線狀態模組2.ConnectTest2("172.1.1.189,2433") = True Then : 登入() : 刷卡登入_ch.Checked = True : Else : MGB(對話框(11), 1) : Me.Close() : End If
  119. Else : MGB(對話框(11), 1) : Me.Close() : End If
  120. End If
  121. End Sub
  122. Private Sub 登入()
  123. '-----------------------寫入連線字串-----------------------------------------------------------------------------------------------------------------------------------------------
  124. If Strings.Left(伺服器區域_cb.Text, 2) = "印尼" Or Strings.Left(伺服器區域_cb.Text, 2) = "公司" Then
  125. SQL_連線字串_正式() : SQL_連線字串_正式_工程SQL() : SQL_連線字串_正式_管理SQL()
  126. Else
  127. SQL_連線字串_測試() : SQL_連線字串_測試_工程SQL() : SQL_連線字串_測試_管理SQL()
  128. End If
  129. g_conn_type = 伺服器區域_cb.Text & "伺服器"
  130. '-----------------------系統版本號寫入-----------------------------------------------------------------------------------------------------------------------------------------------
  131. SQL_系統版本號驗證()
  132. If dr.Read() Then : 資料庫版本 = dr("內帳系統") : 版本號 = dr("內帳系統") : End If : conn.Close()
  133. 語言轉換讀取()
  134. 系統語言_cb.Items.Clear() : 系統語言_cb.Items.Add("繁體中文") : 系統語言_cb.Items.Add("Indonesian") : 系統語言_cb.Items.Add("English")
  135. '-----MAC碼與硬碟資料-------------------------------------------------------------------------------------------------------------------------------------------------------------
  136. Dim Wmi As New Management.ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration")
  137. For Each WmiObj As Management.ManagementObject In Wmi.Get
  138. If CBool(WmiObj("IPEnabled")) Then
  139. MACKK = WmiObj("MACAddress")
  140. End If
  141. Next
  142. Dim cmicWmi As New Management.ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive")
  143. For Each cmicWmiObj As Management.ManagementObject In cmicWmi.Get
  144. diskId = cmicWmiObj("size") 'diskId = cmicWmiObj("signature")
  145. diskSerialNumber = cmicWmiObj("serialnumber")
  146. diskModel = cmicWmiObj("Model")
  147. Exit For
  148. Next
  149. End Sub
  150. Private verificationCode As String
  151. Private verificationStartTime As DateTime
  152. Dim currentTime As DateTime
  153. Dim elapsedTime As TimeSpan
  154. Private Sub GenerateVerificationCode()
  155. Dim random As New Random() : verificationCode = random.Next(10000000, 99999999).ToString() : verificationStartTime = DateTime.Now : LIN訊息通知("CC260", PA50, verificationCode)
  156. End Sub
  157. Private Sub Form_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
  158. Select Case e.KeyCode
  159. Case Keys.NumPad1 : Me.ActiveControl = Button1 : Button1.PerformClick() : Me.ActiveControl = Button18
  160. Case Keys.NumPad2 : Me.ActiveControl = Button2 : Button2.PerformClick() : Me.ActiveControl = Button18
  161. Case Keys.NumPad3 : Me.ActiveControl = Button3 : Button3.PerformClick() : Me.ActiveControl = Button18
  162. Case Keys.NumPad4 : Me.ActiveControl = Button4 : Button4.PerformClick() : Me.ActiveControl = Button18
  163. Case Keys.NumPad5 : Me.ActiveControl = Button5 : Button5.PerformClick() : Me.ActiveControl = Button18
  164. Case Keys.NumPad6 : Me.ActiveControl = Button6 : Button6.PerformClick() : Me.ActiveControl = Button18
  165. Case Keys.NumPad7 : Me.ActiveControl = Button7 : Button7.PerformClick() : Me.ActiveControl = Button18
  166. Case Keys.NumPad8 : Me.ActiveControl = Button8 : Button8.PerformClick() : Me.ActiveControl = Button18
  167. Case Keys.NumPad9 : Me.ActiveControl = Button9 : Button9.PerformClick() : Me.ActiveControl = Button18
  168. Case Keys.NumPad0 : Me.ActiveControl = Button10 : Button10.PerformClick() : Me.ActiveControl = Button18
  169. Case Keys.Decimal : Me.ActiveControl = Button12 : Button12.PerformClick() : Me.ActiveControl = Button18
  170. Case Keys.D1 : Me.ActiveControl = Button1 : Button1.PerformClick() : Me.ActiveControl = Button18
  171. Case Keys.D2 : Me.ActiveControl = Button2 : Button2.PerformClick() : Me.ActiveControl = Button18
  172. Case Keys.D3 : Me.ActiveControl = Button3 : Button3.PerformClick() : Me.ActiveControl = Button18
  173. Case Keys.D4 : Me.ActiveControl = Button4 : Button4.PerformClick() : Me.ActiveControl = Button18
  174. Case Keys.D5 : Me.ActiveControl = Button5 : Button5.PerformClick() : Me.ActiveControl = Button18
  175. Case Keys.D6 : Me.ActiveControl = Button6 : Button6.PerformClick() : Me.ActiveControl = Button18
  176. Case Keys.D7 : Me.ActiveControl = Button7 : Button7.PerformClick() : Me.ActiveControl = Button18
  177. Case Keys.D8 : Me.ActiveControl = Button8 : Button8.PerformClick() : Me.ActiveControl = Button18
  178. Case Keys.D9 : Me.ActiveControl = Button9 : Button9.PerformClick() : Me.ActiveControl = Button18
  179. Case Keys.D0 : Me.ActiveControl = Button10 : Button10.PerformClick() : Me.ActiveControl = Button18
  180. Case Keys.OemPeriod : Me.ActiveControl = Button12 : Button12.PerformClick() : Me.ActiveControl = Button18
  181. Case Keys.Delete : Me.ActiveControl = Button11 : Button11.PerformClick() : Me.ActiveControl = Button18
  182. Case Keys.Multiply : Me.ActiveControl = Button15 : Button15.PerformClick() : Me.ActiveControl = Button18
  183. Case Keys.Subtract : Me.ActiveControl = Button14 : Button14.PerformClick() : Me.ActiveControl = Button18
  184. Case Keys.OemMinus : Me.ActiveControl = Button14 : Button14.PerformClick() : Me.ActiveControl = Button18
  185. Case Keys.Add : Me.ActiveControl = Button13 : Button13.PerformClick() : Me.ActiveControl = Button18
  186. Case Keys.Oemplus : Me.ActiveControl = Button13 : Button13.PerformClick() : Me.ActiveControl = Button18
  187. Case Keys.Oem2 : Me.ActiveControl = Button16 : Button16.PerformClick() : Me.ActiveControl = Button18
  188. Case Keys.Divide : Me.ActiveControl = Button16 : Button16.PerformClick() : Me.ActiveControl = Button18
  189. Case Keys.Back : Me.ActiveControl = Button11 : Button11.PerformClick() : Me.ActiveControl = Button18
  190. Case Keys.Return : Me.ActiveControl = Button11 : Button11.PerformClick() : Me.ActiveControl = Button18
  191. End Select
  192. End Sub
  193. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  194. If 後數_tb.Text <> "" Then : 後數_tb.Text = 後數_tb.Text & 1 : Else : 後數_tb.Text = 1 : End If : 計算呈現()
  195. End Sub
  196. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  197. If 後數_tb.Text <> "" Then : 後數_tb.Text = 後數_tb.Text & 2 : Else : 後數_tb.Text = 2 : End If : 計算呈現()
  198. End Sub
  199. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  200. If 後數_tb.Text <> "" Then : 後數_tb.Text = 後數_tb.Text & 3 : Else : 後數_tb.Text = 3 : End If : 計算呈現()
  201. End Sub
  202. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  203. If 後數_tb.Text <> "" Then : 後數_tb.Text = 後數_tb.Text & 4 : Else : 後數_tb.Text = 4 : End If : 計算呈現()
  204. End Sub
  205. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
  206. If 後數_tb.Text <> "" Then : 後數_tb.Text = 後數_tb.Text & 5 : Else : 後數_tb.Text = 5 : End If : 計算呈現()
  207. End Sub
  208. Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
  209. If 後數_tb.Text <> "" Then : 後數_tb.Text = 後數_tb.Text & 6 : Else : 後數_tb.Text = 6 : End If : 計算呈現()
  210. End Sub
  211. Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
  212. If 後數_tb.Text <> "" Then : 後數_tb.Text = 後數_tb.Text & 7 : Else : 後數_tb.Text = 7 : End If : 計算呈現()
  213. End Sub
  214. Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
  215. If 後數_tb.Text <> "" Then : 後數_tb.Text = 後數_tb.Text & 8 : Else : 後數_tb.Text = 8 : End If : 計算呈現()
  216. End Sub
  217. Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
  218. If 後數_tb.Text <> "" Then : 後數_tb.Text = 後數_tb.Text & 9 : Else : 後數_tb.Text = 9 : End If : 計算呈現()
  219. End Sub
  220. Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
  221. If 後數_tb.Text <> "" Then : 後數_tb.Text = 後數_tb.Text & 0 : Else : 後數_tb.Text = 0 : End If : 計算呈現()
  222. End Sub
  223. Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
  224. If 後數_tb.Text <> "" Then : 後數_tb.Text = 後數_tb.Text & "." : Else : 後數_tb.Text = "0." : End If : 計算呈現()
  225. End Sub
  226. '----------------------------數字鍵盤---------------------------------------------------------------------------------------------------------------
  227. Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
  228. Dim SS As Integer
  229. If 後數_tb.Text <> "" Then : 後數_tb.Text = Int(Val(後數_tb.Text) / 10)
  230. ElseIf 後數_tb.Text = "" And 前數_tb.Text <> "" Then : SS = Len(前數_tb.Text) : 前數_tb.Text = Strings.Left(前數_tb.Text, SS - 1)
  231. Else : 後數_tb.Text = "" : End If : 計算呈現()
  232. End Sub
  233. Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
  234. Button18.PerformClick()
  235. If 後數_tb.Text <> "" And 前數_tb.Text = "" Then : 前數_tb.Text = 後數_tb.Text : 後數_tb.Text = "" : End If
  236. If 後數_tb.Text <> "" And 前數_tb.Text <> "" Then : 前數_tb.Text = Val(前數_tb.Text) / Val(後數_tb.Text) : 後數_tb.Text = "" : End If
  237. 算式_tb.Text = "/" : 計算呈現()
  238. End Sub
  239. Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
  240. Button18.PerformClick()
  241. If 後數_tb.Text <> "" And 前數_tb.Text = "" Then : 前數_tb.Text = 後數_tb.Text : 後數_tb.Text = "" : End If
  242. If 後數_tb.Text <> "" And 前數_tb.Text <> "" Then : 前數_tb.Text = Val(後數_tb.Text) * Val(前數_tb.Text) : 後數_tb.Text = "" : End If
  243. 算式_tb.Text = "X" : 計算呈現()
  244. End Sub
  245. Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
  246. Button18.PerformClick()
  247. If 後數_tb.Text <> "" And 前數_tb.Text = "" Then : 前數_tb.Text = 後數_tb.Text : 後數_tb.Text = "" : End If
  248. If 後數_tb.Text <> "" And 前數_tb.Text <> "" Then : 前數_tb.Text = Val(後數_tb.Text) + Val(前數_tb.Text) : 後數_tb.Text = "" : End If
  249. 算式_tb.Text = "+" : 計算呈現()
  250. End Sub
  251. Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
  252. Button18.PerformClick()
  253. If 後數_tb.Text <> "" And 前數_tb.Text = "" Then : 前數_tb.Text = 後數_tb.Text : 後數_tb.Text = "" : End If
  254. If 後數_tb.Text <> "" And 前數_tb.Text <> "" Then : 前數_tb.Text = Val(前數_tb.Text) - Val(後數_tb.Text) : 後數_tb.Text = "" : End If
  255. 算式_tb.Text = "-" : 計算呈現()
  256. End Sub
  257. Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
  258. 後數_tb.Text = "" : 前數_tb.Text = "" : 算式_tb.Text = "" : 合計_tb.Text = "" : 計算呈現()
  259. End Sub
  260. Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles 前數_tb.TextChanged
  261. 合計_tb.Text = 前數_tb.Text
  262. If 前數_tb.Text = "" Then : Else
  263. If 前數_tb.Text - Int(前數_tb.Text) <> 0 Then : 合計_tb.Text = Format(Val(合計_tb.Text), "#,##0.0000") : Else : 合計_tb.Text = Format(Val(合計_tb.Text), "#,##0") : End If
  264. End If
  265. If Val(前數_tb.Text) > 9.99973000350998E+85 Then : MsgBox("EFFORT错误!结果过大请点击AC重新启动!!!") : End If
  266. End Sub
  267. Private Sub 計算()
  268. If 後數_tb.Text <> "" And 前數_tb.Text <> "" Then
  269. If 算式_tb.Text = "X" Then : 前數_tb.Text = Val(後數_tb.Text) * Val(前數_tb.Text) : 後數_tb.Text = "" : End If
  270. If 算式_tb.Text = "/" Then : 前數_tb.Text = Val(前數_tb.Text) / Val(後數_tb.Text) : 後數_tb.Text = "" : End If
  271. If 算式_tb.Text = "+" Then : 前數_tb.Text = Val(後數_tb.Text) + Val(前數_tb.Text) : 後數_tb.Text = "" : End If
  272. If 算式_tb.Text = "-" Then : 前數_tb.Text = Val(前數_tb.Text) - Val(後數_tb.Text) : 後數_tb.Text = "" : End If
  273. Else : End If : 計算呈現()
  274. End Sub
  275. Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
  276. If 可登入 = False Then : 計算() : Else
  277. If verificationCode = "" Then : 計算() : Else
  278. currentTime = DateTime.Now
  279. elapsedTime = currentTime - verificationStartTime
  280. If elapsedTime.TotalMinutes <= 0.5 Then
  281. If 呈現_tb.Text = verificationCode Then : Me.Hide() : LoginForm1.Show() : verificationCode = "" : Else : 計算() : End If
  282. Else : 計算() : End If
  283. End If
  284. End If
  285. End Sub
  286. Private Sub 計算呈現()
  287. If 後數_tb.Text <> "" And 算式_tb.Text = "" And 前數_tb.Text = "" And 合計_tb.Text = "" Then : 呈現_tb.Text = 後數_tb.Text
  288. ElseIf 後數_tb.Text = "" And 算式_tb.Text <> "" And 前數_tb.Text <> "" And 合計_tb.Text = "" Then : 呈現_tb.Text = 前數_tb.Text
  289. ElseIf 後數_tb.Text = "" And 算式_tb.Text <> "" And 前數_tb.Text <> "" And 合計_tb.Text <> "" Then : 呈現_tb.Text = 合計_tb.Text
  290. ElseIf 後數_tb.Text = "" And 算式_tb.Text <> "" And 前數_tb.Text = "" And 合計_tb.Text = "" Then : 呈現_tb.Text = "0"
  291. ElseIf 後數_tb.Text = "" And 算式_tb.Text = "" And 前數_tb.Text = "" And 合計_tb.Text = "" Then : 呈現_tb.Text = "0"
  292. ElseIf 後數_tb.Text <> "" And 算式_tb.Text <> "" And 前數_tb.Text <> "" And 合計_tb.Text <> "" And CLng(前數_tb.Text) = CLng(合計_tb.Text) Then
  293. 呈現_tb.Text = Strings.Format(CDbl(前數_tb.Text), "#,##0.00") & " " & 算式_tb.Text & " " & Strings.Format(CDbl(後數_tb.Text), "#,##0.00")
  294. ElseIf 後數_tb.Text <> "" And 算式_tb.Text <> "" And 前數_tb.Text <> "" And 合計_tb.Text <> "" And CLng(前數_tb.Text) <> CLng(合計_tb.Text) Then
  295. 呈現_tb.Text = 合計_tb.Text
  296. End If
  297. End Sub
  298. Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
  299. If 可登入 = False Then
  300. Dim result As Double = Math.Sqrt(CDbl(呈現_tb.Text))
  301. 呈現_tb.Text = Strings.Format(result, "#,##0.0000")
  302. Else : GenerateVerificationCode() : 呈現_tb.Text = "0" : End If
  303. End Sub
  304. End Class