Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Structure NumberFile
- Dim Name As String 'Record structure for a record with 2 fields
- Dim Cost As String
- End Structure
- Private Sub btnProcess_Click(sender As Object, e As EventArgs) Handles btnProcess.Click
- Dim file As String
- Dim Price As NumberFile
- file = CurDir() & "\test.txt"
- FileOpen(1, file, OpenMode.Input)
- Do While Not EOF(1)
- Input(1, Price.Name)
- Input(1, Price.Cost)
- lstName.Items.Add(Price.Name)
- lstCost.Items.Add(Price.Cost)
- Loop
- FileClose(1)
- End Sub
- Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
- Dim file As String
- Dim Price As NumberFile
- Price.Name = txtName.Text
- Price.Cost = txtCost.Text
- file = CurDir() & "\test.txt"
- lstName.Items.Clear()
- lstCost.Items.Clear()
- FileOpen(1, file, OpenMode.Append)
- WriteLine(1, Price.Name, Price.Cost)
- txtName.Text = ""
- txtCost.Text = ""
- txtName.Focus()
- FileClose(1)
- End Sub
- Private Sub btnSearchName_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Dim Price As NumberFile
- Dim file As String
- file = CurDir() & "\test.txt"
- FileOpen(1, file, OpenMode.Input)
- Do While Not EOF(1)
- Input(1, Price.Name)
- Input(1, Price.Cost)
- If txtSearchName.Text = Price.Name Then
- lblResult.Text = Price.Name & "owes the college money " & Price.Cost
- txtSearchName.Text = ""
- txtSearchName.Focus()
- End If
- Loop
- FileClose(1)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement