Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8773499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:18:37+00:00 2026-06-13T18:18:37+00:00

The goal of this visual basic program is to store inputs from a file,

  • 0

The goal of this visual basic program is to store inputs from a file, then output them in a label. They should be displayed one value at a time. My idea is to store the values in a index, but it’s clunky, and it does not work.

The program has a next and previous buttons that increase and decrease the value of the index in the output.

This is the code I’m using.

    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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:18:38+00:00Added an answer on June 13, 2026 at 6:18 pm

    Your file reading is not really optimal. Try this instead (import system.IO):

    Dim readText() As String = File.ReadAllLines(OpenFileDialog.FileName);
    

    Then you can just do (readText must be a global variable at this point,same goes for index):

    Output1label.Text = readText(index)
    Output2label.text = readText(index)
    

    On Next and Prev buttons do:

    index = index+1 (on prev index-1)
    Output1label.Text = readText(index)
    Output2label.text = readText(index)
    

    Also don’t forget to check readText.Length to make sure you don’t go out of the array size.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My goal is to get a Time instance from a DateTime instance This has
Goal: Provide a web service using Visual Basic or C# or .NET that interacts
I created an XSD file from Visual Studio and can generate a sample XML
I'm writing a program for my visual basic class that computes the prices of
Hi Im using Visual Basic 2008 Express Edition, my goal is to read an
The end goal of this part of my project is to be able to
This is the goal: to remove Navigation Bar in some of the editors (no
my goal is if I have this: colmuns c1 | c2 | c3 |
Here's my ultimate goal in all of this. I have a viewcontroller with a
I have data like this: Team | goal a | 5 b | 8

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.