|
其中3.0 是行数 168996.50 是汇总金额 20110422 为日期 是从DTPicker1得到的
其他的格式不变
我源程序如下:
'添加CommonDialog1,Command1,Command2,Command3,Text1,DTPicker1
'Text1的Multiline设为True,Scrollbar看需要选择
Dim fname$, aa$
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2 '窗体置屏幕中间
'Command1.Caption = "打开"
'Command2.Caption = "保存"
End Sub
Private Sub Command1_Click(Index As Integer)
On Error GoTo errhandler
With CommonDialog1
.CancelError = True
.InitDir = App.Path '予设存档路径
.Filter = "文档文件(*.txt)|*.txt"
.ShowOpen '或commonDialog1.Action = 1 打开文件
End With
fname = CommonDialog1.FileName
'从上面打开的记事本文件读入资料加进Text1.text
Open fname For Input As #1
Text1.Text = ""
While Not EOF(1)
Line Input #1, aa
Text1.Text = Text1.Text & Trim(aa) & vbCrLf
Wend
Close #1
errhandler:
If Err = 32755 Then '选择了取消
Exit Sub
End If
End Sub
Private Sub Command2_Click(Index As Integer)
On Error GoTo errhandler
With CommonDialog1
.CancelError = True
.InitDir = App.Path '予设存档路径
.Filter = "文档文件(*.txt)|*.txt"
.ShowSave '或commonDialog1.Action = 2 保存文件
End With
fname = CommonDialog1.FileName
'将Text1.text写入上面选择的文件中
Open fname For Output As #1
Print #1, Text1.Text
Close #1
errhandler:
If Err = 32755 Then '选择了取消
Exit Sub
End If
End Sub
Private Sub 关闭_Click()
End
End Sub
请高手指点:
或发邮件到我邮箱 [email protected]
没有人回答啊。能帮我解决的我追加高分的啊
|