12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- Option Strict Off
- Public Class 系統通用變數管理
- ReadOnly ds As New DataSet
- Dim EDR As Integer = 0 : Dim ESTR As String
- Private Sub Set_通用預設值一()
- DataGridView1.DataSource = Nothing : ds.Clear() : DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView1.ColumnHeadersHeight = 25 : DataGridView1.AllowUserToAddRows = False
- SQL_通用預設值管理清單一()
- da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
- DataGridView1.Columns(0).FillWeight = 60 : DataGridView1.Columns(1).FillWeight = 100 : DataGridView1.Columns(2).FillWeight = 300 : DataGridView1.Columns(3).FillWeight = 100
- End Sub
- Private Sub 系統通用變數管理_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
- Set_通用預設值一()
- End Sub
- Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
- If e.RowIndex = -1 Then : Else
- TextBox1.Text = DataGridView1(0, e.RowIndex).Value.ToString : TextBox2.Text = DataGridView1(1, e.RowIndex).Value.ToString
- TextBox3.Text = DataGridView1(2, e.RowIndex).Value.ToString : TextBox4.Text = DataGridView1(3, e.RowIndex).Value.ToString
- End If
- End Sub
- Private Sub SET_新增按鈕程式共用2()
- CmdSet_For_dr() : Dim unused = MsgBox("新增完成") : conn.Close() : dr.Close()
- End Sub
- Private Sub SET_修改按鈕程式共用1()
- CmdSet_For_dr() : Dim unused = MsgBox("修改完成") : conn.Close()
- End Sub
- Private Sub SET_刪除按鈕程式共用1()
- Dim aa As MsgBoxResult = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
- If aa = MsgBoxResult.Ok Then : ConnOpen() : CmdSet_For_dr() : MsgBox("刪除完成") : End If : conn.Close() : 式共用1()
- End Sub
- Private Sub 式共用1()
- Set_通用預設值一() : PA = ""
- End Sub
- Private Sub 式共用2()
- dr.Close() : ConnOpen()
- End Sub
- Private Sub 式共用3()
- ConnOpen()
- End Sub
- '------------------------------------------------------------------------------------------------------------------------------------
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- If TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Then : MsgBox("資料缺失,不可有空白")
- Else
- '----------------------自动生成流水号-------------------------------------------------------------------------
- SQL_系統通用變數管理流水號查詢()
- If dr.Read() Then : EDR = Double.Parse(Strings.Right(dr("流水號").ToString, 3)) : Else : EDR = 0 : End If : conn.Close() : EDR += 1
- If EDR < 10 Then : ESTR = "DV" & "00" & EDR
- ElseIf EDR > 9 And EDR < 100 Then : ESTR = "DV" & "0" & EDR
- ElseIf EDR > 99 Then : ESTR = "DV" & EDR : End If : PA1 = ESTR : PA2 = TextBox2.Text : PA3 = TextBox3.Text : PA4 = TextBox4.Text
- 式共用2() : SQL_系統通用變數管理新增() : SET_新增按鈕程式共用2()
- End If : 式共用1()
- End Sub
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
- If TextBox1.Text = "" Or TextBox3.Text = "" Or TextBox2.Text = "" Or TextBox4.Text = "" Then : MsgBox("資料有缺或有誤,請重新檢查")
- Else
- PA1 = TextBox1.Text : PA2 = TextBox2.Text : PA3 = TextBox3.Text : PA4 = TextBox4.Text
- 式共用3() : SQL_系統通用變數管理修改() : SET_修改按鈕程式共用1()
- End If : 式共用1()
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- PA1 = TextBox1.Text : SQL_系統通用變數管理刪除() : SET_刪除按鈕程式共用1()
- End Sub
- End Class
|