这个 Visual Basic 程序的目标是存储来自文件的输入,然后将它们输出到标签中。它们应该一次显示一个值。我的想法是将值存储在索引中,但它很笨重,而且不起作用。
该程序有一个下一个和上一个按钮,用于增加和减少输出中索引的值。
这是我正在使用的代码。
Public Sub FileModeButton_Click(sender As System.Object, e As System.EventArgs) Handles FileModeButton.Click
Dim Result As DialogResult = OpenFileDialog.ShowDialog()
If Result = DialogResult.Cancel Then
Return
End If
FileOpen(1, OpenFileDialog.FileName, OpenMode.Input)
Index = 1
Do While Not EOF(1)
'Need to keep more than one stored set of outputs.
Input(1, FileOutput1)
Input(1, FileOutput2)
FileOut1(Index) = FileOutput1
FileOut2(Index) = FileOutput2
Index += 1
Loop
FileClose(1)
End Sub
Private Sub ApplyButton_Click(sender As System.Object, e As System.EventArgs) Handles ApplyButton.Click
Index = 1
If ModeComboBox.Text = "File" Then
FileModeGroupBox.Enabled = True
TextboxModeGroupBox.Enabled = False
Output1Label.Text = FileOut1(Index)
Output2Label.Text = FileOut2(Index)
End If
End Sub