Hello all! I'm hoping that you might be able to provide a little help. I've been working on this project for my class, and so far I've been doing okay, but I've reached a point where I'm completely stuck. I have to print a sorted array, and I'm just not connecting the dots. I'm not expecting the complete answer, just a nudge in the right direction. As such, any and all help is appreciated.

The program has three buttons: Sort, Print, and Exit.

I've coded the Sort button's click event to change the original two-dimentional array into a one-dimentioal array and sort the contents in the one-dimential array. From what I can tell by stepping through the program, those steps are done without a problem. I'm having trouble getting the sorted contents of the array to write to my .txt file that I created using a streamwriter object.

Here's the code for the Sort button.

Private Sub uiSortButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles uiSortButton.Click

        sortedReportStreamWriter = IO.File.AppendText("sortedreport.txt")

        sorted(0) = unsorted(0, 0)
        sorted(1) = unsorted(1, 0)
        sorted(2) = unsorted(2, 0)
        sorted(3) = unsorted(3, 0)
        sorted(4) = unsorted(4, 0)

        sorted(5) = unsorted(0, 1)
        sorted(6) = unsorted(1, 1)
        sorted(7) = unsorted(2, 1)
        sorted(8) = unsorted(3, 1)
        sorted(9) = unsorted(4, 1)

        Dim name As String
        For Each name In sorted
        Next name
11 Years
Discussion Span
Last Post by NiaSoul01
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.