Hey everyone, I am looking for some help with some basic coding.
I am new at VB and I am having trouble writing a sub procedure that is capable of searching through my structure.
Any help would be appreciated, below is my code so far.
structure:
And this is my output subprocedure:
So how would I go about writing a searching sub process? I would also like to be able to inform the user if the txt file hasnt been created yet.
I made an input box through a menu command, but that's as far as I can get
Thanks.
-Jeff
I am new at VB and I am having trouble writing a sub procedure that is capable of searching through my structure.
Any help would be appreciated, below is my code so far.
structure:
Code:
Imports System.IO
Public Class Form1
Const strFILENAME As String = "Videos.txt"
Structure VideoData
Dim name As String
Dim yearProduced As String
Dim runningTime As String
Dim rating As String
End Structure
Private Sub mnuFileSaveRecord_Click(sender As System.Object, e As System.EventArgs) Handles mnuFileSaveRecord.Click
Dim video1 As VideoData
With video1
.name = CStr(txtName.Text)
.yearProduced = CStr(txtYear.Text)
.runningTime = CStr(txtTime.Text)
.rating = CStr(txtRating.Text)
End With
WriteRecordToFile(video1)
End Sub
Code:
Sub WriteRecordToFile(ByRef video As VideoData)
Dim outFile As StreamWriter
outFile = File.AppendText(strFILENAME)
outFile.WriteLine(video.name)
outFile.WriteLine(video.yearProduced)
outFile.WriteLine(video.runningTime)
outFile.WriteLine(video.rating)
outFile.Close()
ClearForm()
End Sub
I made an input box through a menu command, but that's as far as I can get
Code:
Private Sub mnuSearchClick_Click(sender As System.Object, e As System.EventArgs) Handles mnuSearchClick.Click
InputBox("Enter video name:", "Search")
End Sub
-Jeff