注册 登录
编程论坛 VB.NET论坛

VB.NET制作excle表格能帮我解释一下里面的意思吗?

q2364123772 发布于 2016-12-21 15:48, 2584 次点击
If Dir(Data) = "" Then
            File.AppendAllText(Data & Format(Now, "yyyy-MM-dd") & ".CSV", "  日期" & "," & "  时间" & "," & _
                               " 生产总量" & "," & "  不良数" & "," & "  不良率" & "," & _
                               "   备注" & vbCrLf, encoding:=System.Text.Encoding.GetEncoding("gb2312"))
        End If
大体的意思明白,File.AppendAllText(str1,str2)
我想知道里面"," 代表什么意思,以及后面的vbCrLf, encoding:=System.Text.Encoding.GetEncoding("gb2312")代表什么意义,我将后面的删除,程序照样运行。那他的作用是什么呢!
2 回复
#2
不说也罢2016-12-21 15:56
"," ——CSV格式文件的分隔符
vbCrLf——换行符,输出一行后换行,准备下一行的输出
encoding:=System.Text.Encoding.GetEncoding("gb2312")——输出字符串的编码类型,请查看System.Text类。
#3
com343142017-05-23 21:03
If Dir(Data) = "" Then
             File.AppendAllText(Data & Format(Now, "yyyy-MM-dd") & ".CSV", "  日期" & "," & "  时间" & "," & _
                                " 生产总量" & "," & "  不良数" & "," & "  不良率" & "," & _
                                "   备注" & www., encoding:=System.Text.Encoding.GetEncoding("gb2312"))
         End If
大体的意思明白,File.AppendAllText(str1,str2)
1