📄 frmdocedit.frm
字号:
VERSION 5.00
Begin VB.Form FrmDocEdit
BorderStyle = 1 'Fixed Single
Caption = "编辑项目文档信息"
ClientHeight = 2805
ClientLeft = 45
ClientTop = 345
ClientWidth = 5775
Icon = "FrmDocEdit.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2805
ScaleWidth = 5775
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 1815
Left = 240
TabIndex = 4
Top = 120
Width = 5295
Begin VB.TextBox txtTitle
Height = 270
Left = 1200
MaxLength = 20
TabIndex = 1
Top = 795
Width = 3855
End
Begin VB.ComboBox ComboType
Height = 300
ItemData = "FrmDocEdit.frx":1272
Left = 1200
List = "FrmDocEdit.frx":1288
Style = 2 'Dropdown List
TabIndex = 0
Top = 300
Width = 1575
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "文档作者"
Height = 180
Left = 240
TabIndex = 10
Top = 1320
Width = 720
End
Begin VB.Label lblAuthor
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "lblAuthor"
Height = 180
Left = 1200
TabIndex = 9
Top = 1320
Width = 810
End
Begin VB.Label Label11
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "保存日期"
Height = 180
Left = 2880
TabIndex = 8
Top = 1320
Width = 720
End
Begin VB.Label lblSaveTime
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "lblSaveTime"
Height = 180
Left = 3840
TabIndex = 7
Top = 1320
Width = 990
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "文档标题"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 6
Top = 840
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "文档类型"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 5
Top = 360
Width = 720
End
End
Begin VB.CommandButton Cmd_Ok
Caption = "确 定"
Height = 400
Left = 1435
MouseIcon = "FrmDocEdit.frx":12C8
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 2160
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
Cancel = -1 'True
Caption = "取 消"
Height = 400
Left = 3040
MouseIcon = "FrmDocEdit.frx":15D2
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 3
Top = 2160
Width = 1300
End
End
Attribute VB_Name = "FrmDocEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriId As Integer
Public OriTitle As String
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
'判断用户录入数据的有效性
If Trim(txtTitle) = "" Then
MsgBox "请输入文档标题"
txtTitle.SetFocus
Exit Sub
End If
With MyDoc
'判断文档标题是否已经存在,如果存在,则不能再添加到数据库中
If Modify = False Or OriTitle <> Trim(txtTitle) Then
If .In_DB(CurProj.ProjId, MakeStr(txtTitle)) = True Then
MsgBox "文档标题已经存在,请重新输入"
txtTitle.SetFocus
txtTitle.SelStart = 0
txtTitle.SelLength = Len(txtTitle)
Exit Sub
End If
End If
'把用户录入的数据赋值到MyDoc对象中
.Title = MakeStr(txtTitle)
.ProjId = CurProj.ProjId
.DocType = ComboType.ListIndex + 1
.fName = ""
.Author = CurUser.Ename
.SaveTime = Format(Now, "yyyy-mm-dd")
'根据变量Modify的值决定是插入新数据,还是修改已有的数据
If Modify = False Then
.Insert
Else
.Update (OriId)
End If
End With
'关闭窗体
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -