| | |
Reading from a text file and using it as a database
![]() |
•
•
Join Date: Apr 2007
Posts: 22
Reputation:
Solved Threads: 0
Ok... I have backups of all my movies on my computer... I am trying to make a database of them using VB. I already made one with OOCalc (Open Office Excel basically). Anyways... my code to enter a movie in the data base is as follows:
(Please keep in mind i rushed this code and didnt do alot of the standard naming)
Now what I want to do is add another form to the project. I want this for to be able to read from the text files and use it as a database so that when I select a movie from the drop down list, it will display all the data and have a button to open winamp to play the movies. I have no idea on how to go about this and any help will be appreciated. Thanks
(Please keep in mind i rushed this code and didnt do alot of the standard naming)
Private Sub Command2_Click()
Open "C:\Movies\Data Base\Name.txt" For Append As #1
Write #1, txtname.Text
Close #1
Open "C:\Movies\Data Base\Location.txt" For Append As #1
Write #1, txtlocation.Text
Close #1
Open "C:\Movies\Data Base\imdb.txt" For Append As #1
Write #1, txtimdb.Text
Close #1
Open "C:\Movies\Data Base\personal.txt" For Append As #1
Write #1, txtpersonal.Text
Close #1
Open "C:\Movies\Data Base\year.txt" For Append As #1
Write #1, txtyear.Text
Close #1
Open "C:\Movies\Data Base\genre1.txt" For Append As #1
Write #1, txtgenre1.Text
Close #1
Open "C:\Movies\Data Base\genre2.txt" For Append As #1
Write #1, txtgenre2.Text
Close #1
Open "C:\Movies\Data Base\Director.txt" For Append As #1
Write #1, txtdirector.Text
Close #1
Open "C:\Movies\Data Base\Lead1.txt" For Append As #1
Write #1, txtlead1.Text
Close #1
Open "C:\Movies\Data Base\Lead2.txt" For Append As #1
Write #1, txtlead2.Text
Close #1
Open "C:\Movies\Data Base\Lead3.txt" For Append As #1
Write #1, txtlead3.Text
Close #1
MsgBox "Data saved"
End Sub
Now what I want to do is add another form to the project. I want this for to be able to read from the text files and use it as a database so that when I select a movie from the drop down list, it will display all the data and have a button to open winamp to play the movies. I have no idea on how to go about this and any help will be appreciated. Thanks
•
•
Join Date: Apr 2007
Posts: 22
Reputation:
Solved Threads: 0
ok... I got the code for reading from lines, ect:
Now I have one more problem I really need help with. Opening the video file with the strlocation variable. I have a command button (cmdplay) and I want to be able to open the movie with that button after it is selected. Thank you
Private Sub cbotitle_Click()
Dim strmovie As String, strlocation As String, strimdb As String, strper As String, stryear As String, strgen1 As String, strgen2 As String, strdirect As String, strlead1 As String, strlead2 As String, strlead3 As String
Open "C:\Movies\Data Base\Movie.txt" For Input As #2
Do While Not EOF(2)
Input #2, strmovie, strlocation, strimdb, strper, stryear, strgen1, strgen2, strdirect, strlead1, strlead2, strlead3
If strmovie = cbotitle.Text Then
lblimdb.Caption = "IMDb Rating:" & vbCrLf & strimdb
lblpersonal.Caption = "Personal Rating:" & vbCrLf & strper
lblyear.Caption = "Year:" & vbCrLf & stryear
lblgen1.Caption = "Main Genre:" & vbCrLf & strgen1
lblgen2.Caption = "Second Genre:" & vbCrLf & strgen2
lbldirect.Caption = "Director: " & strdirect
lbllead1.Caption = "Leading Actor: " & strlead1
lbllead2.Caption = "Secondary Actor: " & strlead2
lbllead3.Caption = "Supporting Actor: " & strlead3
End If
Loop
Close #2
End Sub
Now I have one more problem I really need help with. Opening the video file with the strlocation variable. I have a command button (cmdplay) and I want to be able to open the movie with that button after it is selected. Thank you
![]() |
Similar Threads
- Reading numbers from a text file (Java)
- Reading through lines of text file sequencially (Shell Scripting)
- read from database and writing the contents into a text file (C)
- Need Help in Reading characters from a text file (C++)
- Help Reading Info in Text File Into an Array (C++)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: winsock()
- Next Thread: Link textbox value to verbiage in Word.
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





