VB 2005ch. 10 exercise 3

Discussion in 'Software' started by Markiss, Apr 27, 2008.

  1. Markiss

    Markiss Private E-2

    I am in Advanced Visual Basic(2005). I am stuck on the Glover Industries ch. 10 exercise #3.

    What am I missing? I am reading text from sequential file and placing it in list box then associating the sequenrial access file( parallel array items(4)) to a price label using the selectIndexChanged event. I have done everything teaching myself to this point. I could use a kind soul to help me out.
    http://www.geocities.com/markissrenne
    Here is my code so far:

    Option Explicit On
    Option Strict On

    Public Class MainForm

    Structure Product
    Public itemNumb As String
    Public itemPrice As Decimal

    End Structure

    Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    ' fills list box with item numbers from sequential access file

    Dim items(4) As Product
    Const textFile As String = ("ItemInfo.txt")
    Dim ItemInfo As String
    Dim numb As String
    Dim price As String
    Dim newLineIndex As Integer
    Dim itemIndex As Integer



    For subscript As Integer = 0 To 4
    If My.Computer.FileSystem.FileExists(textFile) Then
    ItemInfo = My.Computer.FileSystem.ReadAllText(textFile)
    newLineIndex = ItemInfo.IndexOf(ControlChars.NewLine)
    newLineIndex = 7
    numb = ItemInfo.Substring(itemIndex, newLineIndex)

    Me.xNumbersListBox.Items.Add(numb).ToString()
    items(subscript).itemNumb = numb
    numb = textFile.Substring(0, 7)
    textFile.IndexOf(ControlChars.NewLine, itemIndex)
    itemIndex = newLineIndex + 2
    newLineIndex = ItemInfo.IndexOf(ControlChars.NewLine)

    End If
    Next subscript

    End Sub


    Private Sub xExitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xExitButton.Click
    Me.Close()
    End Sub

    Private Sub xNumbersListBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles xNumbersListBox.SelectedIndexChanged


    End Sub
    End Class
     
  2. Jungalist

    Jungalist Private E-2

    That isn't a very good description of your problem. What is it doing? What is it supposed to do? What have you tried?
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds