📄 main_bdwdy.frm
字号:
VERSION 5.00
Begin VB.Form main_bdwdy
BorderStyle = 3 'Fixed Dialog
Caption = "系统初始设计--【本单位定义】"
ClientHeight = 3300
ClientLeft = 2775
ClientTop = 4005
ClientWidth = 6810
Icon = "main_bdwdy.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3300
ScaleWidth = 6810
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command1
Caption = "退出"
Height = 960
Left = 5730
TabIndex = 15
Top = 2160
Width = 930
End
Begin VB.Frame Frame1
Height = 3015
Left = 195
TabIndex = 0
Top = 90
Width = 5355
Begin VB.TextBox gs
Height = 315
Index = 6
Left = 705
MaxLength = 20
ScrollBars = 2 'Vertical
TabIndex = 14
Top = 2505
Width = 4305
End
Begin VB.TextBox gs
Height = 315
Index = 5
Left = 1530
TabIndex = 12
Top = 2055
Width = 3465
End
Begin VB.TextBox gs
Height = 315
Index = 4
Left = 1200
TabIndex = 10
Top = 1605
Width = 3795
End
Begin VB.TextBox gs
Height = 315
Index = 3
Left = 1035
TabIndex = 8
Top = 1155
Width = 3945
End
Begin VB.TextBox gs
Height = 315
Index = 2
Left = 1065
TabIndex = 6
Top = 705
Width = 3930
End
Begin VB.TextBox gs
Height = 315
Index = 1
Left = 3195
TabIndex = 4
Top = 255
Width = 1815
End
Begin VB.TextBox gs
Height = 315
Index = 0
Left = 1080
TabIndex = 2
Top = 240
Width = 1215
End
Begin VB.Label Label7
Caption = "备注"
Height = 330
Left = 300
TabIndex = 13
Top = 2550
Width = 1035
End
Begin VB.Label Label6
Caption = "开户银行及帐号"
Height = 330
Left = 240
TabIndex = 11
Top = 2100
Width = 1365
End
Begin VB.Label Label5
Caption = "税务登记号"
Height = 330
Left = 270
TabIndex = 9
Top = 1650
Width = 1035
End
Begin VB.Label Label4
Caption = "公司地址"
Height = 330
Left = 270
TabIndex = 7
Top = 1200
Width = 1035
End
Begin VB.Label Label3
Caption = "公司全称"
Height = 330
Left = 270
TabIndex = 5
Top = 750
Width = 1035
End
Begin VB.Label Label2
Caption = "公司电话"
Height = 210
Left = 2385
TabIndex = 3
Top = 300
Width = 780
End
Begin VB.Label Label1
Caption = "公司简称"
Height = 330
Left = 270
TabIndex = 1
Top = 300
Width = 1035
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 bdwdy ", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
For i = 0 To 6
If rs1.Fields(i) <> "" Then gs(i).Text = Trim(rs1.Fields(i))
Next i
End If
rs1.Close
Me.Caption = Me.Caption & " 操作员: " & frm_main.St1.Panels(3).Text
End Sub
Private Sub Form_Unload(Cancel As Integer)
Command1_Click
End Sub
Private Sub gs_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn And Index < 6 Then gs(Index + 1).SetFocus '回车获得焦点
If KeyCode = vbKeyReturn And Index = 6 Then Command1.SetFocus
If KeyCode = vbKeyUp And Index > 1 Then gs(Index - 1).SetFocus
End Sub
Private Sub Command1_Click()
rs1.Open "select * from bdwdy", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
For i = 0 To 6
rs1.Fields(i) = Trim(gs(i).Text) '赋值给rs1.field(i)
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
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -