vb.net 写数据csv

这个VB.NET程序定义了一个结构aa,包含字符串a、整数b和布尔值c。在Form2_Load事件中,程序初始化了aa结构的数组,并将数据写入CSV文件"CsvTest.csv"。每行数据由a字段的值、逗号分隔和b字段的值组成,c字段未写入。程序首先检查文件是否存在,如果存在则删除,然后创建新文件并写入数据。
摘要由CSDN通过智能技术生成

Public Class Form2
    Public Structure aa
        Dim a As String
        Dim b As Integer
        Dim c As Boolean
    End Structure
    Public sh(222) As aa
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim fileStream As System.IO.FileStream
        Dim streamReader As System.IO.StreamReader
        Dim streamWriter As System.IO.StreamWriter
        Dim strRow As String
        Dim filePath As String = "e:/CsvTest.csv"
        For i As Integer = 0 To 22
            sh(i).a = "zhangxg"
            sh(i).b = i * i
            sh(i).c = (i Mod 2 = 0)
        Next
        Try
            If (System.IO.File.Exists(filePath)) Then
                System.IO.File.Delete(filePath)
            End If

            fileStream = New IO.FileStream(filePath, System.IO.FileM

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值