Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date and time picker control problem

Status
Not open for further replies.

taupirho

Programmer
Jun 25, 2002
680
GB
Apart from setting its enable property to false does anyone know how to prevent the calendar dropping down when you click the drop down arrow on the date and time picker control?
 
Use a hook. [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
CCLINT, I'm not very experienced in VB and using API/hooks. Can you supply more details on how to solve my problem?
 
There is UpDown property of DTPicker, if set to true - instead of arrow a spinbutton is displayed, it changes selected part of date without displaying whole month picture.

combo
 
Thanks for reply combo, but I still have a fundamental problem. Here's the full story behind it, hope someone can help me out.

I'm having some problems validating a textbox field on a userform within EXCEL97. In addition to my textbox I also have an exit button and date and time picker control. My problems are these.

1) I have the following validation code on the exit event of my text box. The idea being that you should not be able to leave this box unless there is a valid number entered or its blank.

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

Cancel = False
If TextBox1.Value = "" Then
Exit Sub
Else

' validation code goes here which
' sets itsvalid to false if its invalid
' and then ...

If itsvalid = false Then
MsgBox ("Invalid number, please re-enter")
Cancel = True
UserForm2.TextBox1.SetFocus
End If
End Sub

This works fine except in the following scenario:- I'm in the textbox, enter an invalid number then click on the down arrow of my date picker control. I get the warning message about the number being invalid but the focus does not seem to be getting set back to the textbox field as the calendar drop down event of my date picker still occurs. Anyone come across this problem before? How do I prevent this happening.

2) My other problem is this. If I'm on the texbox field enter an invalid number then click on my exit button to quit out the form the validation code still fires even though I've set the getfocusonclick to false on my exit button. How do I set it up so that the texbox validation code does NOT fire when I click my exit button?

I suspect I'll have to use API/hooks to do what I want but I'm not experienced in using those techniques so any pointers would be welcome.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top