中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
作者:
标题: 求助,帮忙解决writeline问题 上一主题 | 下一主题
beyond125
初级用户





积分 92
发帖 35
注册 2008-3-25
状态 离线
『楼 主』:  求助,帮忙解决writeline问题

Dim fso, f1, f2, f3, f4, regex, arr Dim str, fn1, fn2, fn3, fn4, fn5, fn6 Private Sub Command1_Click() CommonDialog1.Filter = "LOC文件(*.loc)|*.loc|所有文件(*.*)|*.*" CommonDialog1.ShowOpen fn1 = CommonDialog1.FileName Text1.Text = fn1 End Sub Private Sub Command2_Click() CommonDialog1.Filter = "CSV文件(*.csv)|*.csv|文本文件(*.txt)|txt|所有文件(*.*)|*.*" CommonDialog1.ShowSave fn6 = CommonDialog1.FileName Text2.Text = fn6 End Sub Private Sub Command3_Click() Set fso = CreateObject("scripting.filesystemobject") Set f6 = fso.createtextfile(fn6, True) f6.writeline "Log,Distance,4Hz,4Hz,,Depth" f6.writeline "#,(m),(mA), (dBmA),,(cm)" Set f1 = fso.opentextfile(fn1, 1) Do While f1.atendofstream <> True str = f1.readline If regex.Test(str) Then arr = Split(str, ",") If arr(4) > 0 Then num1 = arr(4) * 1000 num2 = Log(num1) / Log(10) * 20 num3 = arr(2) * 100 f6.writeline arr(1), , num1, Round(num2, 2), , num3 End If End If Loop f6.Close f1.Close MsgBox "数据转换OK" Set f1 = Nothing Set f6 = Nothing Set regex = Nothing Set fso = Nothing End Sub Private Sub exitfile_Click() Unload Me End End Sub Private Sub Form_Load() Text1.Text = "" Text2.Text = "" Set regex = New RegExp End Sub Private Sub openfile_Click() CommonDialog1.Filter = "LOC文件(*.loc)|*.loc|所有文件(*.*)|*.*" CommonDialog1.ShowOpen fn1 = CommonDialog1.FileName Text1.Text = fn1 End Sub Private Sub Option1_Click() regex.Pattern = "^ELF" regex.IgnoreCase = True End Sub Private Sub Text1_Change() Text1.Text = fn1 End Sub 上面的f6.writeline arr(1), , num1, Round(num2, 2), , num3,现示为错误,请各位帮助一下小弟,这句用VB语言如何写!!!


2008-7-8 15:11
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: