📄 form5.vb
字号:
Public Class Form5
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 GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents FpSup As FarPoint.Win.Spread.FpSpread
Friend WithEvents FpSup_Sheet1 As FarPoint.Win.Spread.SheetView
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.FpSup = New FarPoint.Win.Spread.FpSpread
Me.FpSup_Sheet1 = New FarPoint.Win.Spread.SheetView
Me.Button1 = New System.Windows.Forms.Button
Me.GroupBox1.SuspendLayout()
CType(Me.FpSup, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.FpSup_Sheet1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(192, Byte), CType(255, Byte))
Me.GroupBox1.Controls.Add(Me.Button1)
Me.GroupBox1.Controls.Add(Me.FpSup)
Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(552, 224)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
'
'FpSup
'
Me.FpSup.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(192, Byte), CType(255, Byte))
Me.FpSup.Location = New System.Drawing.Point(3, 56)
Me.FpSup.Name = "FpSup"
Me.FpSup.Sheets.AddRange(New FarPoint.Win.Spread.SheetView() {Me.FpSup_Sheet1})
Me.FpSup.Size = New System.Drawing.Size(485, 160)
Me.FpSup.TabIndex = 0
'
'FpSup_Sheet1
'
Me.FpSup_Sheet1.Reset()
Me.FpSup_Sheet1.ColumnCount = 8
Me.FpSup_Sheet1.ColumnHeader.Cells.Get(0, 0).Text = "员工ID"
Me.FpSup_Sheet1.ColumnHeader.Cells.Get(0, 1).Text = "性别"
Me.FpSup_Sheet1.ColumnHeader.Cells.Get(0, 2).Text = "年龄"
Me.FpSup_Sheet1.ColumnHeader.Cells.Get(0, 3).Text = "部门"
Me.FpSup_Sheet1.ColumnHeader.Cells.Get(0, 4).Text = "岗位"
Me.FpSup_Sheet1.ColumnHeader.Cells.Get(0, 5).Text = "出生日期"
Me.FpSup_Sheet1.ColumnHeader.Cells.Get(0, 6).Text = "身份证号"
Me.FpSup_Sheet1.ColumnHeader.Cells.Get(0, 7).Text = "备注"
Me.FpSup_Sheet1.Columns.Get(0).Label = "员工ID"
Me.FpSup_Sheet1.Columns.Get(0).Width = 50.0!
Me.FpSup_Sheet1.Columns.Get(1).Label = "性别"
Me.FpSup_Sheet1.Columns.Get(1).Width = 40.0!
Me.FpSup_Sheet1.Columns.Get(2).Label = "年龄"
Me.FpSup_Sheet1.Columns.Get(2).Width = 40.0!
Me.FpSup_Sheet1.Columns.Get(7).Label = "备注"
Me.FpSup_Sheet1.Columns.Get(7).Width = 100.0!
Me.FpSup_Sheet1.RowHeader.Columns.Default.Resizable = False
Me.FpSup_Sheet1.SheetName = "Sheet1"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(400, 17)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(75, 31)
Me.Button1.TabIndex = 1
Me.Button1.Text = "保存"
'
'Form5
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(488, 222)
Me.Controls.Add(Me.GroupBox1)
Me.Name = "Form5"
Me.Text = "Form5"
Me.GroupBox1.ResumeLayout(False)
CType(Me.FpSup, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.FpSup_Sheet1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strInsert As String = ""
Dim newStr As String
Dim i As Integer
For i = 0 To FpSup.ActiveSheet.ColumnCount - 1
strInsert &= " ,'" & FpSup.ActiveSheet.Cells(0, i).Text & "'"
Next i
newStr = strInsert.Substring(2)
Dim cn As New SqlClient.SqlConnection
Dim cmd As New SqlClient.SqlCommand
cn.ConnectionString = "server=KINGDEE-0C2F4AD;database=WorkSystem;uid=sa;pwd=wujianhfut"
cn.Open()
cmd.Connection = cn
cmd.CommandText = "delete from Workmessage where WorkID='" & FpSup_Sheet1.Cells(0, 0).Text & "'"
cmd.ExecuteNonQuery()
cmd.CommandText = "insert into Workmessage" _
& vbLf & " (WorkID,WorkSex,Workage,Department,IPosition,Birthday,IDcard,Note) " _
& vbLf & " values( " & newStr & " )"
cmd.ExecuteNonQuery()
MsgBox("修改成功")
Dim frmm3 As New Form3
Dim j As Integer
For j = 0 To FpSup.ActiveSheet.ColumnCount - 1
frmm3.FpSView.ActiveSheet.Cells(frmm3.FpSView.ActiveSheet.ActiveRowIndex, j).Text = FpSup.ActiveSheet.Cells(0, j).Text
Next j
Me.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -