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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

maskedEdit 2

Status
Not open for further replies.
Jul 7, 1999
101
US
I would like to see some useable code for MASKEDEDIT working on mydate (mmddyyyy) vb5-e thanks
 
shouldn't be too tough...just depends on what you want to do with it. Need more info
 
hello positran, ref previous: setup textbox1 to auto edit <br>
a date key entered as (01/01/1999 or 12/30/2010 , examples)<br>
edited date is (or moved to) mydate thanks
 
Tusconpapa, Be wary of my undersanding of technical detail. I'm a manager.<br>
<br>
My staff tells me that they are reluctant to use the masked edit control because of "unpredictability". I want to see it used rather than the DTPicker control so I can use it for other purposes including entry of a range of dates for seaching.<br>
<br>
Anyone having good experience with masked edit in VB6-e?
 
masked edit control works fine. I agree that it can be challenging to work with at time. <br>
<br>
set your mask property to ##/##/####. This guarantees that users can only enter numbers and causes a trappable error if they do not complete the date. set the Prompt Include to false. If set to true the prompt character is included in the result string. As your masked edit control looses focus you should check to see that the date they entered is valid. Not 15/15/9999. Use an errror handler for this and mskMyControl.text = "" to reset the conrol to a blank string.<br>
<br>
When user enters 01/01/2000. The string returned by the control is 01012000 but this is easy to parse back to a date value that can be error checked.<br>
<br>
Dim strParse As String<br>
strParse = Left(mskDate.Text, 2) & "/" & Mid(mskDate.Text, 3, 2) & "/" & Right(mskDate.Text, 4)<br>
<br>
On Error GoTo InvalidDate<br>
MsgBox DateValue(strParse), vbInformation, "Valid Date"<br>
Exit Sub<br>
InvalidDate:<br>
mskDate.Text = ""<br>
mskDate.SetFocus<br>
<br>
Hope this help<br>
<br>
Pos
 
Thanks Johnk, a request to Mike Lacey,DataBarn,Hug,Positron,<br>
Alt255, and all others! What is your experience with the<br>
"unpredictability" of Masked Edit. thanks<br>

 
&gt; What is your experience with the "unpredictability" of Masked Edit. thanks &lt;<br>
<br>
As someone who write VB code for sale, I don't trust it.<br>
<br>
It looks at the Windows Locale information (what country am I in) to determine it's format. So in the US, it interprets dates as mm/dd/yy, but in Germany it's dd.mm.yy<br>
<br>
If the end user has monkeyed with their control panel settings, your application doesn't know if it's June 1st, or January 6th. I've seen people play with their timezone info, just to see the map scroll by. And then they click [OK], and wonder why their clock is always wrong. :~)<br>
<br>
Chip H.<br>

 
Hello positran something is still missing! (suprised)?<br>
I went to Project,reference, and checked MSmasked Edit control 5.0 went back to form1, deleted textbox1, went to tools ,dragged maskedbox1 to form 1, went to private sub maskedbox1, put in a couple of dims , then put in ,<br>
maskedEdit.promptinclude = false ... (save) ...which gives when run "method or member not found " <br>
What did I miss ?
 
don't know....that attribute can be set during runtime or design time. Works fine on my end. To Chips point you must be sure that your users are aware that changing time values on the pc can effect the performance or your app. <br>
<br>
Way to go Chip....just goes to show how little I consider who or where my users are or may be. Lesson learned. <br>
<br>
Pos
 
Hello Pos It almost works One problem with <br>
Error 28 "out of stack space" the is clean (I hope)<br>
Thanks for the insight!!
 
Hello Pos It almost works One problem with <br>
Error 28 "out of stack space" then its clean (I hope)<br>
Thanks for the insight!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top