Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2006

Tip: Looking for answers? Try searching our database.

DateTimePicker Control Events

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jille - 17 Nov 2006 18:25 GMT
Hi,

I'm using a DateTimePicker in a Word 2000 userform and want to run a
procedure once a date is chosen. I'm currently using the Change event but
find that it is a problem in that the routine runs when you're in the process
of navigating around the calendar instead of when the user finishing making a
selection.

I checked for other events and found some but wasn't sure which I can/should
use in Word. Any suggestions?  fyi, I found a control.leave,
control.lostfocus and a datetimepicker.valuechanged event and don't
understand the parameters!

Thanks
Anand.V.V.N - 17 Nov 2006 19:00 GMT
Hi
There is a event in the datetime picker called closeup, I think if you write
your code in the closeup event it should solve your problem.

Anand.V.V.N
Signature

"Who will guard the guards?"

> Hi,
>
[quoted text clipped - 10 lines]
>
> Thanks
Anand.V.V.N - 17 Nov 2006 19:02 GMT
Check htis link for more information

http://msdn2.microsoft.com/en-us/library/system.windows.forms.datetimepicker.clo
seup(VS.80).aspx


Anand
Signature

"Who will guard the guards?"

> Hi,
>
[quoted text clipped - 10 lines]
>
> Thanks
jille - 17 Nov 2006 19:35 GMT
I totally get the example code, but haven't dealt with event handlers before
so the following declaration/usage code leaves me cold. Can you help?

Visual Basic (Declaration)
Public Event CloseUp As EventHandler

Visual Basic (Usage)
Dim instance As DateTimePicker
Dim handler As EventHandler

AddHandler instance.CloseUp, handler

FYI, I tried declaring the public event but got an error...is it  

> Check htis link for more information
>
[quoted text clipped - 16 lines]
> >
> > Thanks
Shauna Kelly - 17 Nov 2006 22:43 GMT
Hi jille

It's not as hard as it looks. In the code of your form, at the top left of
the code window, there's a drop down box that lists all the controls on your
form. Choose your date picker in that list.

Now, in the drop down box at the top right, choose CloseUp.

Word will insert the appropriate code. If your datepicker is named, say,
dtpStart then the code will look like

   Private Sub dtpStart_CloseUp()

   End Sub

You can put whatever you like between the two lines of code Word provides.
For example:

   Private Sub dtpStart_CloseUp()
       MsgBox "You chose " & Me.dtpStart.Value
   End Sub

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word

>I totally get the example code, but haven't dealt with event handlers
>before
[quoted text clipped - 35 lines]
>> >
>> > Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.