![]() ![]() ![]() ![]() Gravitybox Schedule Primer
Page 147
1998-2004 Gravitybox Software LLC
To make sure that our menus are always up to date, we will need a method that
enables the menu system when required. If there is an active child form, the save and
print menus should be enabled. However, if there is no active child form these should
be disabled, since it make no since to save or print nothing.
Private Sub UpdateMenu()
Dim bHasChild As Boolean
bHasChild = Not (Me.ActiveForm Is Nothing)
mnuFileClose.Enabled = bHasChild
mnuFileSave.Enabled = bHasChild
mnuFilePrint.Enabled = bHasChild
End Sub
All of this code will actually make a working application that can save and load files. It
can prompt the user for a date to open and error check to make sure that the date is not
loaded. It will make sure that the user cannot accidentally unload a schedule without
saving it. Further, it will print the schedule as well. In all, this is surprisingly little code to
accomplish all of this functionality.
|