📄 form1.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3375
ClientLeft = 60
ClientTop = 450
ClientWidth = 4935
LinkTopic = "Form1"
ScaleHeight = 3375
ScaleWidth = 4935
StartUpPosition = 1 '所有者中心
Begin VB.TextBox TextBoxSave
Height = 375
Left = 1560
TabIndex = 4
Top = 1200
Width = 2175
End
Begin VB.CommandButton Command3
Caption = ".."
Height = 375
Left = 3840
TabIndex = 3
Top = 1200
Width = 495
End
Begin VB.CommandButton Command2
Caption = ".."
Height = 375
Left = 3840
TabIndex = 2
Top = 600
Width = 495
End
Begin VB.TextBox TextBoxOPen
Height = 375
Left = 1560
TabIndex = 1
Top = 600
Width = 2175
End
Begin MSComDlg.CommonDialog CdlTest
Left = 600
Top = 2520
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command1
Caption = "转化文件>>>"
Height = 615
Left = 1680
TabIndex = 0
Top = 2160
Width = 1575
End
Begin VB.Label Label2
Caption = "目标文件:"
Height = 255
Left = 480
TabIndex = 6
Top = 1200
Width = 975
End
Begin VB.Label Label1
Caption = "源文件:"
Height = 255
Left = 720
TabIndex = 5
Top = 720
Width = 855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If TextBoxOPen = "" Then MsgBox "请选择打开文件!": Exit Sub
If TextBoxSave = "" Then MsgBox "请选择要保存文件!": Exit Sub
Dim filess As String, filein As String
Open TextBoxOPen For Input As #1
Open TextBoxSave For Output As #2
While Not EOF(1)
Line Input #1, info
str1 = info
changdu = Len(str1)
b = str1
For i = 1 To changdu
a = Left(b, 1)
b = Right(str1, changdu - i)
If a = vbTab Then
jishu = jishu + 1
c = temp
temp = ""
Else
temp = temp + a
End If
Select Case jishu
Case 6
主 = temp
Case 7
平 = temp
Case 8
负 = temp
Case 11
初主 = temp
Case 12
初平 = temp
Case 13
初负 = b
jishu = 0
End Select
Next
主胜差 = 初主 - 主
主平差 = 初平 - 平
主负差 = 初负 - 负
kk1 = Format(主胜差, "##0.00")
kk2 = Format(主平差, "##0.00")
kk3 = Format(主负差, "##0.00")
Print #2, str1 + vbTab + kk1 + vbTab + kk2 + vbTab + kk3
Wend
Close #1, #2
MsgBox "数据转化完成"
End Sub
Private Sub Command2_Click()
On Error Resume Next
CdlTest.CancelError = True
'属性DialogTitle是要弹出的对话框的标题
CdlTest.DialogTitle = "打开文件"
'缺省的文件名为空
CdlTest.FileName = ""
'属性Filter是文件滤器,返回或设置在对话框的类型列表框中所显示的过滤器。
'语法object.Filter [= 文件类型描述1 |filter1 |文件类型描述2 |filter2...]
CdlTest.Filter = "文本文件(.txt)|*.txt"
'Flags属性的用法依据不同的对话框而变,详细使用需要查找联机帮助手册
CdlTest.Flags = cdlOFNCreatePrompt + cdlOFNHideReadOnly
CdlTest.ShowOpen
If Err = cdlCancel Then Exit Sub
TextBoxOPen.Text = CdlTest.FileName
End Sub
Private Sub Command3_Click()
On Error Resume Next
CdlTest.CancelError = True
CdlTest.DialogTitle = "保存文件"
CdlTest.FileName = ""
CdlTest.Filter = "文本文件(*.txt)|*.txt"
CdlTest.Flags = cdlOFNCreatePrompt + cdlOFNHideReadOnly
CdlTest.ShowSave
If Err = cdlCancel Then Exit Sub
TextBoxSave.Text = CdlTest.FileName
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -