Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

合約編號修改器.vb 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Public Class 合約編號修改器
  2. Private Sub 合約編號修改器_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  3. End Sub
  4. Private Sub 合約編號修改器_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
  5. 合約編號_tb.Text = PA18 : 合約編號1_tb.Text = PA19 : 合約編號2_tb.Text = PA20 : 合約編號3_tb.Text = PA21
  6. If Strings.Left(PA18, 2) = "HX" Then : 合約編號_cb.Text = "HX" : ElseIf Strings.Left(PA18, 3) = "PGS" Then : 合約編號_cb.Text = "PGS" : Else : 合約編號_cb.Text = "" : End If
  7. End Sub
  8. Private Sub 合約編號修正_bt_Click(sender As Object, e As EventArgs) Handles 合約編號修正_bt.Click
  9. Dim 合約編號條件 As Boolean = True
  10. If 合約編號_cb.Text = "" Then : MsgBox("沒有選擇我方公司!!") : 合約編號條件 = False : End If
  11. If 合約編號1_tb.Text = "" Then : MsgBox("沒有甲方公司英文縮寫!!") : 合約編號條件 = False : Else
  12. Dim d As Int32
  13. For index = 0 To 合約編號1_tb.Text.Length - 1
  14. d = Asc(合約編號1_tb.Text(index))
  15. Dim 可能不行 As Boolean = False
  16. If (d < 65 Or d > 90) Then : 可能不行 = True : End If 'c變數若在65~90是大寫的英文字母
  17. If 可能不行 = True Then
  18. If (d < 97 Or d > 122) Then : 可能不行 = True : Else : 可能不行 = False : End If 'c變數若在97~122是小寫的英文字母
  19. If 可能不行 = True Then '然後查表, c變數若在48~57, 表示它是數字,
  20. If (d < 48 Or d > 57) Then : MsgBox("甲方公司需要英文或是數字不可中文或其他!!") : 合約編號條件 = False : Exit For : End If
  21. End If
  22. End If
  23. Next
  24. End If
  25. If 合約編號2_tb.Text = "" Then : MsgBox("沒有立約日期!!") : 合約編號條件 = False : End If
  26. Dim c As Int32 '然後查表, c變數若在48~57, 表示它是數字,
  27. For index = 0 To 合約編號2_tb.Text.Length - 1
  28. c = Asc(合約編號2_tb.Text(index))
  29. If c < 48 Or c > 57 Then : MsgBox("立約日期只能是數字!!") : 合約編號條件 = False : Exit For : Else
  30. If Len(合約編號2_tb.Text) <> 6 Then : MsgBox("立約日期的格式為YYMMDD (年兩位,月兩位,日兩位),數字規格不符!!") : 合約編號條件 = False : Exit For : End If
  31. End If
  32. Next
  33. If 合約編號3_tb.Text = "" Then : MsgBox("沒有合約序號!!") : 合約編號條件 = False
  34. ElseIf IsNumeric(合約編號3_tb.Text) = False Then : MsgBox("序號只能是數字!!") : 合約編號條件 = False
  35. End If
  36. If 合約編號條件 = False Then : Else
  37. PA17 = 合約編號_tb.Text : PA18 = 合約編號_cb.Text & "-" & 合約編號1_tb.Text & " " & 合約編號2_tb.Text & "-" & 合約編號3_tb.Text
  38. PA19 = 合約編號1_tb.Text : PA20 = 合約編號2_tb.Text : PA21 = 合約編號3_tb.Text : PA22 = 合約編號_cb.Text
  39. SQL_合約編號修改()
  40. Me.Close()
  41. End If
  42. End Sub
  43. End Class