?? frmpart.frm
字號(hào):
VERSION 5.00
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form frmPart
BorderStyle = 1 'Fixed Single
Caption = "部門編輯"
ClientHeight = 5010
ClientLeft = 45
ClientTop = 435
ClientWidth = 4275
Icon = "frmPart.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5010
ScaleWidth = 4275
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
Height = 4935
Left = 120
TabIndex = 0
Top = 0
Width = 4095
Begin VB.TextBox Text1
Height = 375
Left = 120
MaxLength = 30
TabIndex = 7
Top = 3480
Width = 2535
End
Begin VB.Frame Frame3
Caption = "說明"
Height = 3615
Left = 2880
TabIndex = 3
Top = 240
Width = 1095
Begin VB.Label Label1
Caption = "Label1"
Height = 3015
Left = 120
TabIndex = 8
Top = 360
Width = 855
End
End
Begin VB.ListBox List1
Height = 3120
Left = 120
TabIndex = 2
Top = 240
Width = 2535
End
Begin VB.Frame Frame2
Caption = "操作"
Height = 855
Left = 120
TabIndex = 1
Top = 3960
Width = 3735
Begin MSForms.CommandButton cmdOk
Default = -1 'True
Height = 375
Left = 120
TabIndex = 6
Top = 360
Width = 975
Caption = "確定"
PicturePosition = 327683
Size = "1720;661"
Picture = "frmPart.frx":0442
FontName = "宋體"
FontHeight = 180
FontCharSet = 134
FontPitchAndFamily= 34
ParagraphAlign = 3
End
Begin MSForms.CommandButton cmdDel
Height = 375
Left = 1320
TabIndex = 5
Top = 360
Width = 975
Caption = "刪除"
PicturePosition = 327683
Size = "1720;661"
Picture = "frmPart.frx":07DC
FontName = "宋體"
FontHeight = 180
FontCharSet = 134
FontPitchAndFamily= 34
ParagraphAlign = 3
End
Begin MSForms.CommandButton cmdExit
Cancel = -1 'True
Height = 375
Left = 2520
TabIndex = 4
Top = 360
Width = 975
Caption = "退出"
PicturePosition = 327683
Size = "1720;661"
Picture = "frmPart.frx":2916
FontName = "宋體"
FontHeight = 180
FontCharSet = 134
FontPitchAndFamily= 34
ParagraphAlign = 3
End
End
End
End
Attribute VB_Name = "frmPart"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Type MYINFO
InfoNO As Integer
InfoName As String * 30
End Type
Dim info As MYINFO
Dim intNum As Integer
Dim intLast As Integer
Dim fso As FileSystemObject
Dim fd As Folder
Dim fl As File
Dim blnChanged As Boolean
Dim strFileName As String
Dim strFullFilePath As String
Private Sub cmdDel_Click()
'刪除記錄
If List1.ListIndex >= 0 Then
blnChanged = True
List1.RemoveItem List1.ListIndex
End If
End Sub
Private Sub cmdExit_Click()
If blnChanged = True Then
mbrtn = MsgBox("是否保存改變", vbQuestion + vbYesNo)
If mbrtn = vbYes Then
delFile
If List1.ListCount = 0 Then
Unload Me
End If
For i = 0 To List1.ListCount - 1
SaveInfo List1.List(i)
Next
End If
End If
Unload Me
If dfIsFormLoad("frmRS") = True Then
frmRS.RefreshPart
End If
End Sub
Private Sub cmdOk_Click()
'添加記錄
If Text1.Text = "" Then Exit Sub
For i = 0 To List1.ListCount - 1
If List1.List(i) = Trim(Text1.Text) Then
Exit Sub
End If
Next
List1.AddItem Trim(Text1.Text)
blnChanged = True
Text1.Text = ""
Text1.SetFocus
End Sub
'刪除文件
Private Function delFile()
Dim p As String
Dim f As String
Set fso = New FileSystemObject
If Not fso.FolderExists(pInfoFolderPath) Then
fso.CreateFolder (pInfoFolderPath)
End If
If fso.FileExists(strFullFilePath) Then
fso.DeleteFile (strFullFilePath)
End If
Set fso = Nothing
End Function
'文件是否存在
Private Function chkFile()
Dim p As String
Dim f As String
Set fso = New FileSystemObject
If Not fso.FolderExists(pInfoFolderPath) Then
fso.CreateFolder (pInfoFolderPath)
End If
If fso.FileExists(strFullFilePath) Then
chkFile = 1
Else
chkFile = 0
End If
Set fso = Nothing
End Function
Private Sub Form_Load()
'設(shè)文件名
strFileName = "PartInfo.txt"
strFullFilePath = pInfoFolderPath & "\" & strFileName
Label1.Caption = "在新增條目對(duì)話框中輸入要新增的條目,按回車即可完成添加資料。" & _
vbCrLf & _
"選列表框中的條目,點(diǎn)刪除按扭即可刪除所選條目"
blnChanged = False
'文件不存在就退出
If chkFile = 0 Then Exit Sub
'讀取文件
intNum = FreeFile
Open strFullFilePath For Random As intNum Len = Len(info)
intLast = LOF(1) / Len(info)
Close intNum
For i = 1 To intLast
List1.AddItem GetInfo(i)
Next
End Sub
Private Function SaveInfo(ByVal strInfoName As String)
intNum = FreeFile
Open strFullFilePath For Random As intNum Len = Len(info)
intLast = LOF(1) / Len(info)
intLast = intLast + 1
info.InfoName = strInfoName
info.InfoNO = intLast
Put #intNum, intLast, info
Close #intNum
End Function
Private Function GetInfo(ByVal intInfoNum As Integer)
intNum = FreeFile
Open strFullFilePath For Random As intNum Len = Len(info)
Get #intNum, intInfoNum, info
GetInfo = info.InfoName
Close #intNum
End Function
Private Sub Label1_Click()
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -