📄 scrap.vb
字号:
'Imports Header.Module2
Imports System.Data
Imports System.Data.SqlClient
Public Class Scrap
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents Label8 As System.Windows.Forms.Label
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents ComboBox3 As System.Windows.Forms.ComboBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Label9 As System.Windows.Forms.Label
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents Label10 As System.Windows.Forms.Label
Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Label5 = New System.Windows.Forms.Label
Me.Label6 = New System.Windows.Forms.Label
Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker
Me.Label7 = New System.Windows.Forms.Label
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.Label8 = New System.Windows.Forms.Label
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.ComboBox3 = New System.Windows.Forms.ComboBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.TextBox7 = New System.Windows.Forms.TextBox
Me.Label10 = New System.Windows.Forms.Label
Me.TextBox6 = New System.Windows.Forms.TextBox
Me.Label9 = New System.Windows.Forms.Label
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.Location = New System.Drawing.Point(0, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(88, 23)
Me.Label1.TabIndex = 0
Me.Label1.Text = "资产报废"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(40, 104)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(88, 23)
Me.Label2.TabIndex = 1
Me.Label2.Text = "部门名称:"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(288, 104)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(72, 23)
Me.Label3.TabIndex = 2
Me.Label3.Text = "报废人:"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(40, 136)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(80, 23)
Me.Label4.TabIndex = 5
Me.Label4.Text = "净 值:"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(128, 136)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(120, 21)
Me.TextBox2.TabIndex = 6
Me.TextBox2.Text = ""
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(288, 136)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(64, 23)
Me.Label5.TabIndex = 7
Me.Label5.Text = "登记人:"
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(40, 168)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(80, 23)
Me.Label6.TabIndex = 9
Me.Label6.Text = "报废日期:"
'
'DateTimePicker1
'
Me.DateTimePicker1.Location = New System.Drawing.Point(128, 168)
Me.DateTimePicker1.Name = "DateTimePicker1"
Me.DateTimePicker1.Size = New System.Drawing.Size(144, 21)
Me.DateTimePicker1.TabIndex = 10
'
'Label7
'
Me.Label7.Location = New System.Drawing.Point(40, 200)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(72, 23)
Me.Label7.TabIndex = 11
Me.Label7.Text = "报废原因:"
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(128, 200)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(344, 21)
Me.TextBox4.TabIndex = 12
Me.TextBox4.Text = ""
'
'Label8
'
Me.Label8.Location = New System.Drawing.Point(40, 232)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(72, 23)
Me.Label8.TabIndex = 13
Me.Label8.Text = "备注:"
'
'TextBox5
'
Me.TextBox5.Location = New System.Drawing.Point(128, 232)
Me.TextBox5.Multiline = True
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.ScrollBars = System.Windows.Forms.ScrollBars.Both
Me.TextBox5.Size = New System.Drawing.Size(344, 48)
Me.TextBox5.TabIndex = 14
Me.TextBox5.Text = ""
'
'ComboBox3
'
Me.ComboBox3.Location = New System.Drawing.Point(368, 136)
Me.ComboBox3.Name = "ComboBox3"
Me.ComboBox3.Size = New System.Drawing.Size(104, 20)
Me.ComboBox3.TabIndex = 16
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(120, 288)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(56, 32)
Me.Button1.TabIndex = 17
Me.Button1.Text = "确 定"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(256, 288)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(48, 32)
Me.Button2.TabIndex = 18
Me.Button2.Text = "清 空"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(368, 288)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(48, 32)
Me.Button3.TabIndex = 19
Me.Button3.Text = "关 闭"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(128, 104)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(120, 21)
Me.TextBox1.TabIndex = 21
Me.TextBox1.Text = ""
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(368, 104)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(104, 21)
Me.TextBox3.TabIndex = 22
Me.TextBox3.Text = "TextBox3"
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.TextBox7)
Me.GroupBox1.Controls.Add(Me.Label10)
Me.GroupBox1.Controls.Add(Me.TextBox6)
Me.GroupBox1.Controls.Add(Me.Label9)
Me.GroupBox1.Enabled = False
Me.GroupBox1.Location = New System.Drawing.Point(88, 24)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(384, 56)
Me.GroupBox1.TabIndex = 23
Me.GroupBox1.TabStop = False
'
'TextBox7
'
Me.TextBox7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TextBox7.Location = New System.Drawing.Point(88, 24)
Me.TextBox7.Name = "TextBox7"
Me.TextBox7.Size = New System.Drawing.Size(96, 21)
Me.TextBox7.TabIndex = 3
Me.TextBox7.Text = ""
'
'Label10
'
Me.Label10.Location = New System.Drawing.Point(16, 32)
Me.Label10.Name = "Label10"
Me.Label10.Size = New System.Drawing.Size(72, 16)
Me.Label10.TabIndex = 2
Me.Label10.Text = "资产编号:"
'
'TextBox6
'
Me.TextBox6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TextBox6.Location = New System.Drawing.Point(264, 24)
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(104, 21)
Me.TextBox6.TabIndex = 1
Me.TextBox6.Text = ""
'
'Label9
'
Me.Label9.Location = New System.Drawing.Point(192, 32)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(72, 16)
Me.Label9.TabIndex = 0
Me.Label9.Text = "资产名称:"
'
'Scrap
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(520, 342)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ComboBox3)
Me.Controls.Add(Me.TextBox5)
Me.Controls.Add(Me.Label8)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.DateTimePicker1)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.MaximizeBox = False
Me.Name = "Scrap"
Me.Text = "-----------资产报废"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Close()
End Sub
Private Sub Scrap_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox6.Text = node2
TextBox7.Text = node1
' Assent()
For Each assentRow In assentDataSet.Tables("T_ASSET_MAIN").Rows
Me.ComboBox3.Items.Add(assentRow("ADD_REN"))
Next
Me.ComboBox3.Text = Me.ComboBox3.Items(0)
TextBox1.Text = node3
TextBox3.Text = node9
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' MsgBox(node1)
MsgBox("确定报废吗?")
Try
myConnStr = connstr()
myConnetion = New SqlConnection(myConnStr)
myConnetion.Open()
myCommand = New SqlCommand("INSERT INTO T_SCRAP VALUES(@c1,@c2,@c3,@c4,@c5,@c6,@c7,@c8,@c9)", myConnetion)
myCommand.Parameters.Add(New SqlParameter("@c1", SqlDbType.VarChar, 6))
myCommand.Parameters("@c1").Value = node1
myCommand.Parameters.Add(New SqlParameter("@c2", SqlDbType.VarChar, 20))
myCommand.Parameters("@c2").Value = TextBox6.Text
myCommand.Parameters.Add(New SqlParameter("@c3", SqlDbType.VarChar, 20))
myCommand.Parameters("@c3").Value = TextBox1.Text
myCommand.Parameters.Add(New SqlParameter("@c4", SqlDbType.VarChar, 10))
myCommand.Parameters("@c4").Value = TextBox3.Text
myCommand.Parameters.Add(New SqlParameter("@c5", SqlDbType.Money))
myCommand.Parameters("@c5").Value = TextBox2.Text
myCommand.Parameters.Add(New SqlParameter("@c6", SqlDbType.VarChar, 200))
myCommand.Parameters("@c6").Value = TextBox4.Text
myCommand.Parameters.Add(New SqlParameter("@c7", SqlDbType.DateTime))
myCommand.Parameters("@c7").Value = CDate(DateTimePicker1.Text)
myCommand.Parameters.Add(New SqlParameter("@c8", SqlDbType.VarChar, 10))
myCommand.Parameters("@c8").Value = ComboBox3.Text
myCommand.Parameters.Add(New SqlParameter("@c9", SqlDbType.VarChar, 200))
myCommand.Parameters("@c9").Value = TextBox5.Text
'Dim im As Integer
myCommand.ExecuteNonQuery()
myConnetion.Close()
myConnetion.Open()
myCommand = New SqlCommand("UPDATE T_ASSET_MAIN SET ASSET_TYPE = @ASSET_TYPE " & _
"WHERE ASSET_CODE = @ASSET_CODE", myConnetion)
myCommand.Parameters.Add("@ASSET_CODE", SqlDbType.VarChar, 6, "ASSET_CODE")
myCommand.Parameters("@ASSET_CODE").Value = node1
myCommand.Parameters.Add("@ASSET_TYPE", SqlDbType.VarChar, 1, "ASSET_TYPE")
myCommand.Parameters("@ASSET_TYPE").Value = 3
myDataAdapter.UpdateCommand = myCommand
Dim i As Integer
i = myCommand.ExecuteNonQuery()
'MsgBox("i is :" & i)
myConnetion.Close()
MsgBox("成功。。。。。")
Catch ex As Exception
MsgBox("出错。。。。。")
End Try
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -