Game Development Reference
Private Sub Cruise_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
'Load up the database.
MDB.Add("French cuisine", "dining")
MDB.Add("Asian cuisine", "dining")
MDB.Add("pub fare", "dining")
'Add people using the people button code.
'Call PeopleButton_Click(Nothing, Nothing)
Our cruise director needs a database and people, so the first thing we did was to
declare variables for them. Upon form load, the Randomize() call reseeds the
random number generator so that we get a different run every time. Then the
code adds activities to the database. At the end, it will eventually add a new group
of people by using the PeopleButton_Click event handler. For now, we leave that
call commented out. Run the code in the debugger and check the debugging
output in the Immediate window. You should see each activity load in the proper
Now that our database can be created, we can add the code that accesses the data.
Switch back to MinDB.vb in the editor. We will start with the database code
needed to help create a person. People will require needs and preferences; we will
add them in that order. Add the following code to the MiniDB class:
'Give some person a set of initialized needs.
Public Function SetOfNeeds() As Collection
Dim PersonalNeeds As New Collection
Dim net As Integer = 0
Dim need As String
Dim thisNeed As NVP = Nothing
For Each need In Needs
thisNeed = New NVP
thisNeed.name = need