📄 main_bdwdy.frm
字号:
VERSION 5.00
Begin VB.Form main_bdwdy
BorderStyle = 3 'Fixed Dialog
Caption = "系统初始设计:本单位定义"
ClientHeight = 3000
ClientLeft = 2775
ClientTop = 3900
ClientWidth = 7815
Icon = "main_bdwdy.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3000
ScaleWidth = 7815
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
Height = 2940
Left = 15
TabIndex = 0
Top = -15
Width = 7710
Begin VB.CommandButton Command1
Caption = "确定"
Height = 330
Left = 6330
TabIndex = 15
Top = 2220
Width = 1155
End
Begin VB.TextBox gs
BackColor = &H80000018&
Height = 390
Index = 6
Left = 1530
MaxLength = 20
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 14
Top = 2190
Width = 4695
End
Begin VB.TextBox gs
BackColor = &H80000018&
Height = 315
Index = 5
Left = 1530
TabIndex = 12
Top = 1800
Width = 6060
End
Begin VB.TextBox gs
BackColor = &H80000018&
Height = 315
Index = 4
Left = 1530
TabIndex = 10
Top = 1410
Width = 6060
End
Begin VB.TextBox gs
BackColor = &H80000018&
Height = 315
Index = 3
Left = 1530
TabIndex = 8
Top = 1020
Width = 6060
End
Begin VB.TextBox gs
BackColor = &H80000018&
Height = 315
Index = 2
Left = 1530
TabIndex = 6
Top = 630
Width = 6060
End
Begin VB.TextBox gs
BackColor = &H80000018&
Height = 315
Index = 1
Left = 4710
TabIndex = 4
Top = 240
Width = 2835
End
Begin VB.TextBox gs
BackColor = &H80000018&
Height = 315
Index = 0
Left = 1530
TabIndex = 2
Top = 240
Width = 1890
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "备 注:"
Height = 180
Left = 120
TabIndex = 13
Top = 2175
Width = 1260
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "开户银行及帐号:"
Height = 180
Left = 120
TabIndex = 11
Top = 1815
Width = 1440
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "税务 登记号:"
Height = 180
Left = 120
TabIndex = 9
Top = 1410
Width = 1170
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "公 司 地 址:"
Height = 180
Left = 120
TabIndex = 7
Top = 1005
Width = 1170
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "公 司 全 称:"
Height = 180
Left = 120
TabIndex = 5
Top = 630
Width = 1170
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "公司电话:"
Height = 180
Left = 3570
TabIndex = 3
Top = 285
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "单 位 简 称:"
Height = 180
Left = 120
TabIndex = 1
Top = 255
Width = 1170
End
End
End
Attribute VB_Name = "main_bdwdy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'定义数据集对象
Dim rs1 As New ADODB.Recordset
Private Sub Form_Activate()
'打开"本单位定义"表
rs1.Open "select * from 本单位定义", cn, adOpenStatic, adLockReadOnly
If rs1.RecordCount > 0 Then
For i = 0 To 6
If rs1.Fields(i) <> "" Then gs(i).text = Trim(rs1.Fields(i)) '给gs(i).text赋值
Next i
End If
'关闭表
rs1.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
'打开"本单位定义"表
rs1.Open "select * from 本单位定义", cnn, adOpenKeyset, adLockPessimistic
If rs1.RecordCount > 0 Then
For i = 0 To 6
rs1.Fields(i) = Trim(gs(i).text) '给字段赋值
Next i
rs1.Update '更新数据表
Else
rs1.AddNew
For i = 0 To 6
If gs(2).text <> "" Then rs1.Fields(i) = Trim(gs(i).text) '给字段赋值
Next i
rs1.Update '更新数据表
End If
'关闭表
rs1.Close
frm_main.Enabled = True
End Sub
Private Sub gs_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
Select Case Index
Case Is = Index
'VbKeyReturn常数为键盘上的"回车键"
If KeyCode = vbKeyReturn And Index < 6 Then gs(Index + 1).SetFocus '回车gs获得焦点
If KeyCode = vbKeyReturn And Index = 6 Then Command1.SetFocus '回车command1获得焦点
If KeyCode = vbKeyUp And Index > 1 Then gs(Index - 1).SetFocus
End Select
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -