1、导入相关的类
Imports System.IO
Imports System.Text
2、定义公用变量
Public wCAMInfo As StreamWriter
Class System.IO.StreamWriter
输出时以特定的编码方式将字元写入位元组资料流的TextWriter
3、指定公用变量
wCAMInfo = New StreamWriter(outputPath & jobName & "_backdrill_depth.txt", False, Encoding.UTF8)
Sub StreamWriter.New(path As String,append As Boolean,encoding As Encoding)
使用指定的编码方式和预设缓冲区大小,为指定的档案初始化StreamWriter类别的新执行个体。如果档案存在,可以将它写入或附加。如果档案不存在,这个建构韩式会建立新的档案。
4、将结果写入Text文档
wCAMInfo.WriteLine(topName & "-all=T" & topCode & "=" & tmpBackDrillData.depth & "mm")
Sub TextWriter.WriterLine(value As String)
将字串(其后加上行结束字元)写入到文字字串或资料流。
5、最后关闭写入
wCAMInfo.Close()