Arrays 我想将变量存储到数组中(VB.NET)

Arrays 我想将变量存储到数组中(VB.NET),arrays,vb.net,csv,multidimensional-array,Arrays,Vb.net,Csv,Multidimensional Array,我希望我的程序将我的输入存储到csv文件中,如下所示: 我写一个单词,例如单词 我写一个定义,例如定义 然后我写5个错误,例如错误1,错误2,错误3,错误4,错误5 看起来是这样的: 单词,定义,错误1,错误2,错误3,错误4,错误5 Dim decision As Char Dim fullline As String = " " Dim word(9), def(9), minorerror(49) As String Console.Clear()

我希望我的程序将我的输入存储到csv文件中,如下所示:

我写一个单词,例如单词

我写一个定义,例如定义

然后我写5个错误,例如错误1,错误2,错误3,错误4,错误5

看起来是这样的:

单词,定义,错误1,错误2,错误3,错误4,错误5

 Dim decision As Char
    Dim fullline As String = " "

    Dim word(9), def(9), minorerror(49) As String

    Console.Clear()

    Console.WriteLine("Select the year you will be saving the test for: ")
    Console.WriteLine()
    Console.WriteLine("3 - Year 3")
    Console.WriteLine("4 - Year 4")
    Console.WriteLine("5 - Year 5")
    Console.WriteLine("6 - Year 6")


    Console.WriteLine()


    Dim testyear As Integer = Console.ReadLine()

    Select Case testyear

        Case 1
        Case 2
        Case 3
        Case 4

    End Select

    Console.WriteLine("Please enter 10 of your selected words, defenitions and selected amount minor errors to be featured in the following test")

    FileOpen(5, "F:\Computing\Spelling Bee\testtests.csv", OpenMode.Append)

    Do

        counter = counter + 1
        Console.Write("Word: ")
        word(counter) = Console.ReadLine
        Console.Write("Defenition: ")
        def(counter) = Console.ReadLine

        Console.WriteLine("Type in a max of 5 minor errors")

        For i As Integer = 1 To 5

            Console.Write("Minor error 1: ")
            minorerror(i + i) = Console.ReadLine
            'Console.Write("Minor error 2: ")
            'minoerror2(counter) = Console.ReadLine
            'Console.Write("Minor error 3: ")
            'minoerror3(counter) = Console.ReadLine
            'Console.Write("Minor error 4: ")
            'minoerror4(counter) = Console.ReadLine
            'Console.Write("Minor error 5: ")
            'minoerror5(counter) = Console.ReadLine

        Next

    Loop Until counter = 9
    Console.Clear()

    Dim x As Integer

    For counter As Integer = 0 To 9
        fullline = word(counter) & "," & def(counter) & "," & minorerror(x + counter)
        PrintLine(5, fullline)
        ' Console.WriteLine("Word: " & (word(counter.ToString)) & " Defenition: " & (def(counter.ToString)) & " Minor error 1: " & (minorerror1(counter.ToString)))
    Next

    Console.WriteLine("Are you sure you want to save this test? (y/n) ")
    decision = Console.ReadLine
    If decision = "y" Or decision = "Y" Then
        FileClose(5)
        staffmenu()
    ElseIf decision = "n" Or decision = "N" Then
        addtest()
单词2,定义3,错误1,错误2,错误3,错误4,错误5

 Dim decision As Char
    Dim fullline As String = " "

    Dim word(9), def(9), minorerror(49) As String

    Console.Clear()

    Console.WriteLine("Select the year you will be saving the test for: ")
    Console.WriteLine()
    Console.WriteLine("3 - Year 3")
    Console.WriteLine("4 - Year 4")
    Console.WriteLine("5 - Year 5")
    Console.WriteLine("6 - Year 6")


    Console.WriteLine()


    Dim testyear As Integer = Console.ReadLine()

    Select Case testyear

        Case 1
        Case 2
        Case 3
        Case 4

    End Select

    Console.WriteLine("Please enter 10 of your selected words, defenitions and selected amount minor errors to be featured in the following test")

    FileOpen(5, "F:\Computing\Spelling Bee\testtests.csv", OpenMode.Append)

    Do

        counter = counter + 1
        Console.Write("Word: ")
        word(counter) = Console.ReadLine
        Console.Write("Defenition: ")
        def(counter) = Console.ReadLine

        Console.WriteLine("Type in a max of 5 minor errors")

        For i As Integer = 1 To 5

            Console.Write("Minor error 1: ")
            minorerror(i + i) = Console.ReadLine
            'Console.Write("Minor error 2: ")
            'minoerror2(counter) = Console.ReadLine
            'Console.Write("Minor error 3: ")
            'minoerror3(counter) = Console.ReadLine
            'Console.Write("Minor error 4: ")
            'minoerror4(counter) = Console.ReadLine
            'Console.Write("Minor error 5: ")
            'minoerror5(counter) = Console.ReadLine

        Next

    Loop Until counter = 9
    Console.Clear()

    Dim x As Integer

    For counter As Integer = 0 To 9
        fullline = word(counter) & "," & def(counter) & "," & minorerror(x + counter)
        PrintLine(5, fullline)
        ' Console.WriteLine("Word: " & (word(counter.ToString)) & " Defenition: " & (def(counter.ToString)) & " Minor error 1: " & (minorerror1(counter.ToString)))
    Next

    Console.WriteLine("Are you sure you want to save this test? (y/n) ")
    decision = Console.ReadLine
    If decision = "y" Or decision = "Y" Then
        FileClose(5)
        staffmenu()
    ElseIf decision = "n" Or decision = "N" Then
        addtest()
我已经在这上面呆了一段时间了,我的单词和定义被很好地存储了,这只是错误


我对编码相当陌生,希望能得到任何帮助。

您尝试过什么吗?请向我们展示您的代码我们不是定制的软件开发服务。向我们展示您尝试了什么以及在哪里发现问题。附:标题中带有“紧急”一词的帖子很少能在SO->统计事实中得到快速回答。我不是那种类型的人,我想学习,而不仅仅是简单地理解它和不理解它。好的。然后最好删除对紧迫性的任何提及,并清楚地解释您想要准确完成什么,以及为什么您的代码没有达到您想要的效果。因此,我键入一个单词,该单词的定义和该单词的五个可接受的小错误。我只是在将小错误存储到csv文件时遇到问题。