Question
Below is my code. I am trying to get the txt file information to load into my 2 list boxes. I can get information to
Below is my code. I am trying to get the txt file information to load into my 2 list boxes. I can get information to load but is it the cost and not the franchise name. How to I get the Franchise name to load when program is started in the first listbox and the cost loaded into the second list box.
Public Class frmFranchise
' Class Level Private variables
Public Shared _intSizeOfArray As Integer = 10 Public Shared _strFranchiseName(_intSizeOfArray) As String Private _strItemId(_intSizeOfArray) As String Private _decInitialPrice(_intSizeOfArray) As Decimal Private _intQuantity(_intSizeOfArray) As Integer
Private Sub frmFranchise_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' The frmDepreciation load event reads the inventory text file and ' fills the Listbox object with the inventory items
' Initialize an instance of the StreamReader object and declare variables Dim objReader As IO.StreamReader Dim strLocationAndNameOfFile As String = "d:\Franchise.txt" Dim intCount As Integer = 0 Dim intFill As Integer Dim strFileError As String = "This File is not available. Restart when the file is available."
' Verify the file exist If IO.File.Exists(strLocationAndNameOfFile) Then objReader = IO.File.OpenText(strLocationAndNameOfFile) ' Read the file line by line until the file is completed Do While objReader.Peek -1 _strFranchiseName(intCount) = objReader.ReadLine() _strItemId(intCount) = objReader.ReadLine() intCount += 1 Loop objReader.Close()
' The ListBox object is filled with the Inventory IDs For intFill = 0 To (_strItemId.Length - 1) lstFranchise.Items.Add(_strItemId(intFill)) Next Else MsgBox(strFileError, , "Error") Close() End If
End Sub
Private Sub mnuDisplay_Click(sender As Object, e As EventArgs) Handles mnuDisplay.Click
End Sub
Private Sub mnuExit_Click(sender As Object, e As EventArgs) Handles mnuExit.Click ' The mnuExit click event closes the window and exits the application
Close() End Sub
Private Sub mnuClear_Click(sender As Object, e As EventArgs) Handles mnuClear.Click 'Clears the average and number of people with high blood pressure TextBoxes
lstFranchise.Items.Clear() lblRestaurants.Visible = False lblAverageCost.Visible = False
End Sub
Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles btnCompute.Click
End Sub
Private Sub lstCost_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstCost.SelectedIndexChanged
End Sub
Private Sub MenuStrip1_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles MenuStrip1.ItemClicked
End Sub
Private Sub lblRestaurants_Click(sender As Object, e As EventArgs) Handles lblRestaurants.Click
End Sub
Private Sub lblAverageCost_Click(sender As Object, e As EventArgs) Handles lblAverageCost.Click
End Sub
Private Sub lstInventoryId_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstFranchise.SelectedIndexChanged
End Sub
Below is the text file information: Franchise.txt
Buffalo Wild Wings 1700000 Cold Stone Creamery 277400 Firehouse Subs 131200 Genghis Grill 346600 Mellow Mushroom 1305000 Papa Murphys 226000 Ritas Italian Ice 140200 Saladworks 401000 Scooters Coffee 237500 Smoothie King 176300 Qdoba Mexican Grill 594000
Franchise Investment Type Here Display Restaurant Names and Investment Values Clear When clicked Loads the restaurants names and investment Values hvestment it Type Here Ist Franchise IstCost media, unique, needs competitive, Wants alue, sales, global business, Success Satisfaction, focus + netWork, consumer Loads all the Franchises Names to pick from. This is read fromthe txt file This is the same as the label. It loads the cost from the txt file franchise This is the cost of the The selected restaurant's investment cost of: Franchise from the text average cost by adding the total file lblRestaurants.Click cost of all the franchises and dividing by the Compute Average Investment number of franchises 1blAverageCost.click Average Investment Cost: Franchise Investment Type Here Display Restaurant Names and Investment Values Clear When clicked Loads the restaurants names and investment Values hvestment it Type Here Ist Franchise IstCost media, unique, needs competitive, Wants alue, sales, global business, Success Satisfaction, focus + netWork, consumer Loads all the Franchises Names to pick from. This is read fromthe txt file This is the same as the label. It loads the cost from the txt file franchise This is the cost of the The selected restaurant's investment cost of: Franchise from the text average cost by adding the total file lblRestaurants.Click cost of all the franchises and dividing by the Compute Average Investment number of franchises 1blAverageCost.click Average Investment Cost
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started