?? frmaddsnippet.frm
字號:
VERSION 5.00
Begin VB.Form frmAddCd
Caption = "Add CD"
ClientHeight = 6000
ClientLeft = 60
ClientTop = 345
ClientWidth = 7785
LinkTopic = "Form1"
ScaleHeight = 6000
ScaleWidth = 7785
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdDone
Caption = "Cancel"
Height = 375
Left = 6240
TabIndex = 5
Top = 120
Width = 1455
End
Begin VB.CommandButton cmdAdd
Caption = "Add Snippet"
Height = 375
Left = 4560
TabIndex = 4
Top = 120
Width = 1455
End
Begin VB.TextBox txtArtist
Height = 4845
Left = 120
MultiLine = -1 'True
TabIndex = 3
Top = 720
Width = 7575
End
Begin VB.TextBox txtTitle
Height = 285
Left = 600
TabIndex = 2
Top = 165
Width = 2415
End
Begin VB.TextBox txtCDID
Height = 285
Left = 3120
TabIndex = 1
Top = 165
Visible = 0 'False
Width = 855
End
Begin VB.Label Label1
Caption = "Title:"
Height = 255
Index = 1
Left = 120
TabIndex = 0
Top = 180
Width = 375
End
End
Attribute VB_Name = "frmAddCd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'##########################
Dim NumRecords As Integer
Dim intFileNum As Integer
Dim lngRecLength As Long
'##########################
Private Type AddCD
intID As Integer
strTitle As String * 30
strArtist As String * 9000
End Type
Private Sub cmdDone_Click()
Unload frmAddCd
End Sub
Private Sub Form_Load()
Dim udtCD As AddCD
Dim intCDFile As Integer, lngRecLength As Long, lngNextCDID As Long
Dim NumRecords As Integer
Dim intFileNum As Integer
intFileNum = FreeFile
'Open File
intCDFile = FreeFile
lngRecLength = LenB(udtCD)
Open "C:\CdIndex.dat" For Random As #intCDFile Len = lngRecLength
'Next rec (NUMRECORDS)
If LOF(intFileNum) Mod lngRecLength = 0 Then
NumRecords = (LOF(intFileNum) \ lngRecLength)
Else
NumRecords = (LOF(intFileNum) \ lngRecLength) + 1
End If
lngNextCDID = NumRecords + 1
txtCDID.Text = lngNextCDID
txtCDID.Enabled = False
Close #intCDFile
End Sub
Private Sub cmdAdd_Click()
Dim udtNewCD As AddCD
Dim intCDFile As Integer, lngRecLength As Long, lngCDID As Long
'Check if not ""
If txtTitle.Text = "" Then
MsgBox ("Please Enter Data")
Exit Sub
Else
'Open File
intCDFile = FreeFile
lngRecLength = LenB(udtNewCD)
Open "C:\CdIndex.dat" For Random As #intCDFile Len = lngRecLength
'Adds New CD
lngCDID = txtCDID.Text
udtNewCD.strArtist = txtArtist.Text
udtNewCD.strTitle = txtTitle.Text
Put #intCDFile, lngCDID, udtNewCD
'Make txt ""
txtCDID.Text = lngCDID + 1
txtTitle.Text = ""
txtArtist.Text = ""
Close #intCDFile
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -