When the LookupButtonClickHandler finds date or datetime in the Tag property of the control that triggered the event, it attempts to display an instance of the Datastream.WinForms.Dialogs.CalendarDlg.
The following steps outline the procedure for a date and datetime lookup.
-
Create a CalendarDlg variable, named dlg, to hold the new instance of CalendarDlg.
Dim dlg As New Datastream.WinForms.Dialogs.CalendarDlg
-
The IncludeTime property will be set to false if the Tag property was date and set to true if the property was datetime. Note that the value has been copied into the LOVDescription variable.
dlg.IncludeTime = (LOVDescription.ToLower() = "datetime")
A call to the PositionAsDropDown method of the dialog is made to have the dialog function as if it were a dropdown. When the dialog is displayed, it will appear below the control that was specified in the call.
dlg.PositionAsDropDown(inputBox)
-
The current value held by the control, if any, is passed to the dialog.
If inputBox.TextLength > 0 Then dlg.Selection = inputBox.Text
The dialog is displayed, and if the user did not Cancel the dialog the selection is assigned to the control.
If dlg.ShowDialog(Me) = DialogResult.OK
Then inputBox.Text = dlg.Selection
End If