Hi all,
What i could really use help on is the Revellos project. For anyone who might possibly have the "Microsoft Visual Basic 2008 Reloaded" book this is on page 579. This is what the page says:
"Revellos has store located in several states. The sales manager has asked you to create an application that he can use to enter the following information for each store: the store number, the state in which the store is located, and the store manager's name. The application should save the information in a sequential access file. Each stores information should appear on a separate line in the file. In other words, the first stores number, state name, and manager ame should appear on the first line in the file. The application also should aloot the sales manager to enter a store number, and then display both the state in which the store is located and the store manager's name. Use the information shown in figure 10-42."
I have all the information coded so i didnt put the information on here. This is what i have so far.

Public Class Form1
Structure Revellos
Public manager As String
Public ID As String
Public state As String
Const file As String = "StoreReport.txt"
Dim report As String
End Structure

Dim store(9) As Revellos

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
store(0).manager = "Jeffery Jefferson"
store(0).ID = "1004"
store(0).state = "Texas"

store(1).manager = "Paula Hendricks"
store(1).ID = "1005"
store(1).state = "Texas"

store(2).manager = "Jake Johansen"
store(2).ID = "1007"
store(2).state = "Arizona"

store(3).manager = "Henry Abernathy"
store(3).ID = "1010"
store(3).state = "Arizona"

store(4).manager = "Barbra Millerton"
store(4).ID = "1011"
store(4).state = "California"

store(5).manager = "Inez Baily"
store(5).ID = "1013"
store(5).state = "California"

store(6).manager = "Sung Lee"
store(6).ID = "1015"
store(6).state = "California"

store(7).manager = "Lou Chan"
store(7).ID = "1016"
store(7).state = "California"

store(8).manager = "Homer Gomez"
store(8).ID = "1017"
store(8).state = "California"

store(9).manager = "Ingrid Nadkarni"
store(9).ID = "1019"
store(9).state = "New Mexico"

Can anyone please help me to where i need to go from here?

Thanks alot,
Sam

to store the information in a sequential file u need to use file access function from VB i.e. FileOpen, FileAccess, FileGet, FilePut
I have done in VB6 the sequence is like this
FileOpen filenumber,filename
FilePut filenumber,recordstring
to write to a file
i hope it will help

Thanks Ahmad, I did get it after many hours over many days. Thanks for your help though.

Sam

ok everyone i figured it out mostly, does anyone know how to Read from a file using the ReadAllText method. I need to read the file and have specific things go into a certain textbox such as the manager name text box.

Thanks
Sam

Hi all, just need a little more help, im getting closer and closer. This is what i have:

Public Class Form1
    Dim str1() As String
    Structure Revellos
        Public manager As String
        Public ID As String
        Public state As String

    End Structure

    Dim store(9) As Revellos

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load




    End Sub

    Private Sub saveBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles saveBtn.Click
        Dim file As String = "Words1.txt"
        Dim number As Integer = numberTxtBox.Text
        Dim manager As String = managerTxtBox.Text
        Dim state As String = stateTxtBox.Text
        Static i As Integer

        If i = 0 Then
            My.Computer.FileSystem.WriteAllText("Words1.txt", _
                                                number & "," & Strings.Space(1) & state & "," & Strings.Space(1) & manager  & ControlChars.NewLine, False)
        Else
            My.Computer.FileSystem.WriteAllText("Words1.txt", _
                                            number & "," & Strings.Space(1) & state & "," & Strings.Space(1) & manager  & ControlChars.NewLine, True)

        End If
        i += 1
        numberTxtBox.Text = String.Empty
        managerTxtBox.Text = String.Empty
        stateTxtBox.Text = String.Empty



    End Sub

    Private Sub displayBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles displayBtn.Click
        Dim filecontents As String = String.Empty
        Dim newlineindex As Integer
        Dim newuserindex As Integer
        Dim commaindex As Integer
        Dim i As Integer
        Dim strfile As String = String.Empty
        Dim curline As Integer
        Dim firstcomma As Integer
        Dim strlabel As String
        Dim commaindex2 As Integer
        Dim mystate As String
        Dim mymanager As String
        Dim mystore As String


        mystate = stateTxtBox.Text
        mymanager = managerTxtBox.Text
        mystore = numberTxtBox.Text


        If My.Computer.FileSystem.FileExists("Words1.txt") Then
            filecontents = My.Computer.FileSystem.ReadAllText("Words1.txt")
            newlineindex = filecontents.IndexOf(ControlChars.NewLine, newuserindex)

            Do Until newlineindex = -1

                'find first comma
                commaindex = filecontents.IndexOf(",", newuserindex)
                'find second comma
                commaindex2 = filecontents.IndexOf(",", commaindex + 1)
                'info after first comma

                stateTxtBox.Text = filecontents.Substring(commaindex + 2, commaindex2 - commaindex - 2)
                'info after second comma
                managerTxtBox.Text = filecontents.Substring(commaindex2 + 2, newlineindex - commaindex2 - 2)
               



                newuserindex = newlineindex + 2
                newlineindex = filecontents.IndexOf(ControlChars.NewLine, newuserindex)
            Loop
        End If





         








    End Sub

    Private Sub exitBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitBtn.Click
        Me.Close()

    End Sub
End Class

I know i have un-used variables, it was alot of testing. What i need now is to search the text file i created. All of the text in the file is on one line such as "1009, Texas, Steve Johnson". There will be 10 or so lines of text. The first textbox on the form is for store number, what i need to do is enter a number such as "1009" and press the display button, i then want the State Textbox to be filled in with "Texas" and the Manager TextBox to be filled with "Steve Johnson". Does anyone know how to do this. Im getting so close. Thanks for the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.