?? form1004.frm
字號:
VERSION 5.00
Begin VB.Form Form1
Caption = "創建文件"
ClientHeight = 3375
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3375
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "結束"
Height = 375
Left = 3360
TabIndex = 12
Top = 2160
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "寫入記錄"
Enabled = 0 'False
Height = 375
Left = 3360
TabIndex = 11
Top = 1320
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "創建文件"
Height = 375
Left = 3360
TabIndex = 10
Top = 600
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Index = 4
Left = 1680
TabIndex = 9
Top = 2640
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Index = 3
Left = 1680
TabIndex = 7
Top = 2040
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Index = 2
Left = 1680
TabIndex = 5
Top = 1440
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Index = 1
Left = 1680
TabIndex = 3
Top = 840
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Index = 0
Left = 1680
TabIndex = 1
Top = 240
Width = 1095
End
Begin VB.Label Label5
Caption = "英語"
Height = 375
Left = 480
TabIndex = 8
Top = 2640
Width = 1095
End
Begin VB.Label Label4
Caption = "數學"
Height = 375
Left = 480
TabIndex = 6
Top = 2040
Width = 1095
End
Begin VB.Label Label3
Caption = "語文"
Height = 255
Left = 480
TabIndex = 4
Top = 1560
Width = 1095
End
Begin VB.Label Label2
Caption = "姓名"
Height = 375
Left = 480
TabIndex = 2
Top = 960
Width = 1095
End
Begin VB.Label Label1
Caption = "學號"
Height = 375
Left = 480
TabIndex = 0
Top = 240
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Fso As New FileSystemObject
Dim TextFile As TextStream
Private Sub Command1_Click()
'單擊創建文件按鈕
Set Fso = CreateObject("Scripting.FileSystemObject")
'創建新文件
Set TextFile = Fso.CreateTextFile("c:\考試成績.txt", True)
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
'單擊寫入記錄按鈕
Dim LineString As String
Dim i As Integer
For i = 0 To 4
If Text1(i) = "" Then
MsgBox "數據未輸完", "輸入數據"
Exit Sub
End If
Next i
LineString = "學號 " & Text1(0).Text
LineString = LineString & " 姓名" & Text1(1).Text
LineString = LineString & " 語文" & Val(Text1(2).Text)
LineString = LineString & " 數學" & Val(Text1(3).Text)
LineString = LineString & " 英語" & Val(Text1(4).Text)
TextFile.WriteLine LineString
Command1.Enabled = False
For i = 0 To 4
Text1(i) = ""
Next i
End Sub
Private Sub Command3_Click()
'單擊結束按鈕
TextFile.Close
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -