|
-
Oct 11th, 2000, 03:23 PM
#1
Thread Starter
New Member
I have two issues concerning a textbox.
Issue 1:
A user can populate a text box with a date value from a calander control by double clicking the textbox (or manualy type in the date). If the textbox is double clicked, and a date is selected from the calander control, part of the date is hi-lighted. The hi-lighed portion could be either the year, the month, the day, or the slash. This requires the user to have to click twice on a control inorder to either set focus on the control or to call the control's click event. Any suggestions?
Issue 2:
I am also using the textbox's AfterUpdate Event to call a date checking subroutine. This routine verifies the date and prompts the user to enter a valid date if necessary. However, I can not use the textbox's setfocus event to set focus to the text box. Here's the error checking subroutine I am using:
Public Sub subCheckDate()
If IsDate(TextBox1.Text) = False And _
UCase(TextBox1.Text) <> UCase("present") Then
MsgBox "Date must be in MM/DD/YYYY format" _
& Chr(13) & "or state 'PRESENT'", vbExclamation, "Invalid Date"
MsgBox strCtrlName
'Set focus to Textbox so User can reinput date
TextBox1.SetFocus
End If
End Sub
-
Oct 12th, 2000, 11:03 AM
#2
Addicted Member
To problem #1: Use selstart and sellength properties of the textbox to hi-light all or none of the characters in the box.
to problem #2: It sounds like you have already unloaded the form. If the form that the control is in isn't loaded, setfocus will error out.
Hope this helps.
-
Oct 13th, 2000, 11:18 AM
#3
Junior Member
SetFocus Problem in Excel.
Regarding your setfocus problem, I ran into what appears to be a similar problem in VBA for Word 2000.
On MSDN, search for Article ID: Q237863, entitled "XL2000: SetFocus Property On TextBox Does Not Work as Expected".
I wound up having to SetFocus in the forms Activate event.
Check it out. Good luck.
Mac
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|