Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have built a movie theater library in VB6. But keep forgetting which was the last movie watched. Want to make a text box that holds that information and automatically changes it when watching the next movie. All data for movie is held in DBGrid1. Which is movie Name, Description, play time and hard drive location. Want to add a new text box that shows which was the last movie viewed. Using VB6.0 on Windows 10 have been trying to figure this out for weeks. I believe it has to be saved differently from the DBGrid be able to exit program come back next day or so and in the text box show which was the last movie watched.

What I have tried:

Books I have don't address this so just been playing around with unknow acts to see what happens
Posted
Updated 2-Jun-23 18:50pm
v2
Comments
Dave Kreskowiak 3-Jun-23 0:53am    
Why does it sound like you're making the MASSIVE mistake of relying on controls to store your data instead of creating actual data classes and structures to hold the data and just using the controls to display and edit the data?

Controls are for displaying and editing data, not storing it!

1 solution

VB6? Seriously? A new VB6 project in 2023? You do realize it was superseded over 20 years ago by the .NET version?

Anyway ... You need to store the info somewhere, and presumably the DataGrid is backed up by a database of some form (but without any idea of your code, we can't tell). The way I'd do it is to add a new column to the DB table which holds a timestamp, and update that each time a movie was played.

Then when you want to see the last-watched movie (or the last ten in order even) you just query the DB and return the latest entry (or the last ten for example).

In an SQL database that's simple:
SQL
SELECT TOP 1 * FROM MyMoviesTable ORDER BY LastViewedAt DESC
But since we have no idea how your code works, we can't give you actual code to work with your app!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900