保存数组并再次读取

问题描述

我有一个随机生成的数组。当我保存数组时,生成的txt文件仅填充有System.String [,]而不是我尝试保存的值。我该如何解决

Dim strFileName As String = String.Empty
    'Set the Save dialog properties
    With SaveFileDialog1
        .DefaultExt = "txt"
        .Filter = "Text Documents (*.txt)|*.txt|All Files (*.*)|*.*"
        .FilterIndex = 1
        .OverwritePrompt = True
        .Title = "Save File"
    End With
If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK And SaveFileDialog1.FileName <> String.Empty Then
        Try
            'Save the file path and name
            strFileName = SaveFileDialog1.FileName

            SaveFile(strFileName,valuein)

        Catch ex As Exception
            MessageBox.Show(ex.Message,My.Application.Info.Title,MessageBoxButtons.OK,MessageBoxIcon.Error)
        End Try
    End If
End Sub
Sub SaveFile(ByVal path As String,ByVal textToSave As String)

    Dim strmWriter As New System.IO.StreamWriter(path,False) 'false = don't append to an existing file
    For Each i In Value
        strmWriter.Write(Value)
    Next
    'strmWriter.Write(textToSave)

    strmWriter.Close()
    strmWriter.dispose()
    'Show the file using the default text file viewer ( probably Notepad will show ).>>
    System.Diagnostics.Process.Start(path)

End Sub

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...