hi all of you. My question is that I have a form with textbox to input the date then when click OK,it process the date.I want to put calendar instead of textboxes,so that the user can select the date in the calendar and not to input the date in the textbox.Thanks in advance if anyone can answer my question
Using Calendar in a form
Collapse
X
-
Presume that the callenday control is called ctlCalendar.
The user selects the date they want to use on the control
when you need to retrieve the date they have chosen it will be stored in
ctlCalendar.val ue. So depending on the method you were using to get the date from the textbox.value, you just need to say ctlCalendar.val ue instead.Comment
-
Thank you very much.But i have another issue.I have already created the calendar,in fatc i have created two calendar one for the "From Date" and the other one for the "To Date".Now I want the Calendar to b hidden in a combo box.so the user just Click on the Combo box and he get the calendar to input the date.thank you in advance for replyingComment
-
Sorry, but you can't "hide" a calendar control in a combobox! What you can do is to make the calendar invisible until the user doubleclicks the textbox that the date will go into. Here's the step-by-step to do that. You have to substitute your own names, of course, and follow this same routine for each of your calendars.
YourTextBoxName is the name of the box that will hold the date.
YourCalendarNam e is the name of your calendar.
First, place the calendar where you want it to appear on the form.
Next, select the calendar and goto Properties--Format and set Visible = No
Then place this code in the form's code module:
[CODE=vb]Private Sub Form_Load()
YourCalendarNam e = Date
End Sub [/CODE]
[CODE=vb]Private Sub YourCalendarNam e_Click()
YourTextBoxName = YourCalendarNam e
YourTextBoxName .SetFocus
YourCalendarNam e.Visible = False
End Sub[/CODE]
[CODE=vb]Private Sub YourTextBoxName _DblClick(Cance l As Integer)
YourCalendarNam e.Visible = True
End Sub[/CODE]
Now, when your user DoubleClicks on the textbox where the date will go, the calendar will appear. The date is picked, and the calendar disappears!
Linq ;0)>Comment
-
Comment