怎样让VB 自定义保存?

来源:百度知道 编辑:UC知道 时间:2024/06/14 09:20:59
我设计了个计算程序
每次运行时 inpubox问你 计算几次? 你就输入几次 ,比如5次
然后 它就返回请计算5次这个信息 怎么实现 你输入几次 它就返回请计算几次?

得出计算结果后,怎么让它保存时: 第一次计算,点保存 就保存为
数据1.txt 第二次就 数据2.txt 。。。。 第五次就 数据5.txt
然后怎样获取,这5次计算结果 相加
还有怎样实现 保存时 自己输入文件名并选择保存格式?
能给个具体的代码么?

'通用文件读入函数
'Readfile(文件绝对路径)
Public Function Readfile(ByVal filepath As String) As String
Dim s As String
Open filepath For Input As #1
While Not EOF(1)
Line Input #1, sline
s = s & sline & vbCrLf
Wend
Close #1
Readfile = s
End Function

Public Function savefile(ByVal filepath As String, ByVal txt As String)
Open filepath For Output As #1
Print #1, txt
Close #1
End Function

这么烦嗦 都不知道计算和保存什么了