Nessuna descrizione
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.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. Option Strict Off
  2. Public Class 系統通用變數管理
  3. ReadOnly ds As New DataSet
  4. Dim EDR As Integer = 0 : Dim ESTR As String
  5. Private Sub Set_通用預設值一()
  6. DataGridView1.DataSource = Nothing : ds.Clear() : DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  7. DataGridView1.ColumnHeadersHeight = 25 : DataGridView1.AllowUserToAddRows = False
  8. SQL_通用預設值管理清單一()
  9. da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
  10. DataGridView1.Columns(0).FillWeight = 60 : DataGridView1.Columns(1).FillWeight = 100 : DataGridView1.Columns(2).FillWeight = 300 : DataGridView1.Columns(3).FillWeight = 100
  11. End Sub
  12. Private Sub 系統通用變數管理_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  13. Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  14. Set_通用預設值一()
  15. End Sub
  16. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
  17. If e.RowIndex = -1 Then : Else
  18. TextBox1.Text = DataGridView1(0, e.RowIndex).Value.ToString : TextBox2.Text = DataGridView1(1, e.RowIndex).Value.ToString
  19. TextBox3.Text = DataGridView1(2, e.RowIndex).Value.ToString : TextBox4.Text = DataGridView1(3, e.RowIndex).Value.ToString
  20. End If
  21. End Sub
  22. Private Sub SET_新增按鈕程式共用2()
  23. CmdSet_For_dr() : Dim unused = MsgBox("新增完成") : conn.Close() : dr.Close()
  24. End Sub
  25. Private Sub SET_修改按鈕程式共用1()
  26. CmdSet_For_dr() : Dim unused = MsgBox("修改完成") : conn.Close()
  27. End Sub
  28. Private Sub SET_刪除按鈕程式共用1()
  29. Dim aa As MsgBoxResult = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
  30. If aa = MsgBoxResult.Ok Then : ConnOpen() : CmdSet_For_dr() : MsgBox("刪除完成") : End If : conn.Close() : 式共用1()
  31. End Sub
  32. Private Sub 式共用1()
  33. Set_通用預設值一() : PA = ""
  34. End Sub
  35. Private Sub 式共用2()
  36. dr.Close() : ConnOpen()
  37. End Sub
  38. Private Sub 式共用3()
  39. ConnOpen()
  40. End Sub
  41. '------------------------------------------------------------------------------------------------------------------------------------
  42. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  43. If TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Then : MsgBox("資料缺失,不可有空白")
  44. Else
  45. '----------------------自动生成流水号-------------------------------------------------------------------------
  46. SQL_系統通用變數管理流水號查詢()
  47. If dr.Read() Then : EDR = Double.Parse(Strings.Right(dr("流水號").ToString, 3)) : Else : EDR = 0 : End If : conn.Close() : EDR += 1
  48. If EDR < 10 Then : ESTR = "DV" & "00" & EDR
  49. ElseIf EDR > 9 And EDR < 100 Then : ESTR = "DV" & "0" & EDR
  50. ElseIf EDR > 99 Then : ESTR = "DV" & EDR : End If : PA1 = ESTR : PA2 = TextBox2.Text : PA3 = TextBox3.Text : PA4 = TextBox4.Text
  51. 式共用2() : SQL_系統通用變數管理新增() : SET_新增按鈕程式共用2()
  52. End If : 式共用1()
  53. End Sub
  54. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  55. If TextBox1.Text = "" Or TextBox3.Text = "" Or TextBox2.Text = "" Or TextBox4.Text = "" Then : MsgBox("資料有缺或有誤,請重新檢查")
  56. Else
  57. PA1 = TextBox1.Text : PA2 = TextBox2.Text : PA3 = TextBox3.Text : PA4 = TextBox4.Text
  58. 式共用3() : SQL_系統通用變數管理修改() : SET_修改按鈕程式共用1()
  59. End If : 式共用1()
  60. End Sub
  61. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  62. PA1 = TextBox1.Text : SQL_系統通用變數管理刪除() : SET_刪除按鈕程式共用1()
  63. End Sub
  64. End Class