![]() ![]() ![]() ![]() Gravitybox Schedule Primer
Page 62
1998-2004 Gravitybox Software LLC
upon exit. The deleted array will store the Id of any room that has been removed while
using the screen.
Public Sub LoadForm()
Dim NewEl As clsItemEl
Dim Db As ADODB.Connection
Dim rs As ADODB.Recordset
Set Db = New ADODB.Connection
Db.ConnectionString = GetConnectString & AppPath _
& "schedule.mdb"
Db.Open
Set rs = New ADODB.Recordset
Set rs = Db.Execute("select * from [Room] order by
sortorder")
Call Rooms.Clear
While Not rs.EOF
Set NewEl = Rooms.Add(rs!Name)
NewEl.Id = rs!RoomId
rs.MoveNext
Wend
'Deallocate objects
Call rs.Close
Call Db.Close
Set rs = Nothing
Set Db = Nothing
Call Redraw
End Sub
After the Rooms collection is loaded, we need populate the listbox with the room
names. This is performed in the Redraw method. It will clear the listbox and load it with
the contents of the Rooms collection.
Private Sub Redraw()
'Reloads the combo with the Rooms
Dim i As Integer
Call lstRoom.Clear
For i = 1 To Rooms.Count
Call lstRoom.AddItem(Rooms(i).Name)
|