Hello all,

I could finally save my array to the textfile but how can I format the textfile so that i will have 9 rows and 9 columns

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click

        Dim cellValue As String, i As Integer
        Dim returnValue As Boolean
        Dim FileWriter As StreamWriter
        Dim results As DialogResult

        results = SaveFileDialog1.ShowDialog

        If results = DialogResult.OK Then
            FileWriter = New StreamWriter(SaveFileDialog1.FileName, False)


            For r As Integer = 1 To 3
                For rr As Integer = 1 To 3
                    For c As Integer = 1 To 3
                        For rc As Integer = 1 To 3

                            cellValue = xx(r, c).rec(rr, rc).Text
                            returnValue = String.IsNullOrEmpty(cellValue)
                            If returnValue = True Then

                                FileWriter.Write("00 ")
                            Else
                                FileWriter.WriteLine(cellValue + " ")

                            End If
                        Next


                        i += 1
                    Next
                Next
            Next
            FileWriter.Close()


        End If
        Me.Close()
    End Sub

I am getting my output like this

8
00 00 00 00 00 00 00 00 00 7
00 13
00 17
00 21
00 00 00 1
00 53
00 51
00 00 00 3
00 00 00 00 00 27
00 00 00 79
00 00 00 49
00 00 00 75
00 00 00 00 00 31
00 00 00 73
00 45
00 47
00 00 00 67
00 63
00 41
00 35
00 00 00 00 00 00 00 00 00 00


but I want to format like

00 00 00 00 00 00 00 00 00
00 07 00 13 00 17 00 21 00
00 00 01 00 53 00 51 00 00
00 03 00 00 00 00 00 27 00
00 00 79 00 00 00 49 00 00
00 75 00 00 00 00 00 31 00
00 00 73 00 45 00 47 00 00
00 67 00 63 00 41 00 35 00
00 00 00 00 00 00 00 00 00

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.