用vb.net做一个转档测试程式

如图左下角 把下面每个信息通过程式读取,_是区分和图二差不多的转档测试程式, 测试log如附件,log路径如下: D:\NHR Test Reports\03-28833\Pass 希望大家多看看帮忙解决一下

img

img

要读取目录还是文件?不是用OpenFileDialog选中文件后用io来读取,前提是知道文件格式

Imports System.IO
Imports System.Text
Public Class Form1
    Dim fn As String = "data.txt"
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        If File.Exists(fn) Then
            Dim s As String = File.ReadAllText(fn)
            Dim arr() As String = s.Split("|")
            TextBox1.Text = arr(0)
            TextBox2.Text = arr(1)
            TextBox3.Text = arr(2)
        End If
    End Sub

    Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
        Dim s As String = TextBox1.Text + "|" + TextBox2.Text + "|" + TextBox3.Text
        File.WriteAllText(fn, s, Encoding.UTF8)
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim d As FileDialog = New OpenFileDialog()
        If d.ShowDialog() = DialogResult.OK Then
            Dim path As String = d.FileName
            Dim content As String = System.IO.File.ReadAllText(path, System.Text.Encoding.UTF8)
            '处理content的代码,需要知道文件结构,下面仅输出内容
            MsgBox(path & vbNewLine & content)
        End If
    End Sub
End Class


您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632