Brak opisu
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.

DELIVERY_ADDRESS__資料管理.vb 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. Option Strict Off
  2. Public Class DELIVERY_ADDRESS__資料管理
  3. Private ReadOnly ds As New DataSet
  4. Private Sub Set_DELIVERYADDRESS清單()
  5. 主表單_dgv.DataSource = Nothing : ds.Clear()
  6. 主表單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  7. 主表單_dgv.ColumnHeadersHeight = 25
  8. 主表單_dgv.AllowUserToAddRows = False
  9. SQL_DELIVERYADDRESS清單()
  10. da.Fill(ds) : 主表單_dgv.DataSource = ds.Tables(0) : conn.Close()
  11. 主表單_dgv.Columns(0).Width = 310 : 主表單_dgv.Columns(1).Width = 1000
  12. End Sub
  13. Private Sub DELIVERY_ADDRESS__資料管理_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  14. FormBorderStyle = FormBorderStyle.SizableToolWindow : ControlBox = False
  15. Set_DELIVERYADDRESS清單()
  16. End Sub
  17. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 主表單_dgv.CellClick
  18. If e.RowIndex = -1 Then : Else
  19. Remark_tb.Text = 主表單_dgv(0, e.RowIndex).Value.ToString : 地址_tb.Text = 主表單_dgv(1, e.RowIndex).Value.ToString
  20. End If
  21. End Sub
  22. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles 新增_bt.Click
  23. If Remark_tb.Text <> "" Then
  24. SQL_查詢REMARK()
  25. If dr.Read() Then
  26. conn.Close() : MsgBox("資料重複")
  27. Else
  28. SQL_查詢REMARK1()
  29. If dr.Read() Then
  30. conn.Close() : MsgBox("資料重複")
  31. Else
  32. SQL_新增DELIVERYADDRESS() : conn.Close()
  33. Set_DELIVERYADDRESS清單() : MsgBox("新增完成")
  34. End If
  35. End If
  36. Else
  37. MsgBox("Key index 不可空白")
  38. End If
  39. End Sub
  40. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles 修改_bt.Click
  41. If Remark_tb.Text <> "" Then
  42. SQL_REMARK地址()
  43. If dr.Read() Then
  44. conn.Close() : MsgBox("資料重複")
  45. Else
  46. SQL_修改REMARK地址() : conn.Close()
  47. Set_DELIVERYADDRESS清單() : MsgBox("修改完成")
  48. End If
  49. Else
  50. MsgBox("Key index 不可空白")
  51. End If
  52. End Sub
  53. Private Sub Button3_Click(sender As Object, e As EventArgs) Handles 刪除_bt.Click
  54. Dim aa As MsgBoxResult
  55. aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
  56. If aa = MsgBoxResult.Ok Then
  57. SQL_刪除DELIVERYADDRESS() : conn.Close()
  58. Set_DELIVERYADDRESS清單()
  59. MsgBox("刪除完成")
  60. End If
  61. End Sub
  62. Private Sub Button4_Click(sender As Object, e As EventArgs) Handles 關閉_bt.Click
  63. Me.Close()
  64. End Sub
  65. End Class