jalo Posted October 23, 2005 Posted October 23, 2005 Can anyone give me an idea of how i can force a particular predefined format for the input in a textbox?... in particular, i need to force 2 things (on 2 different texboxes): 1. date entry of the format mm/dd/yyyy 2. entry of the format xx-nnnn-nn (where x=alphabetic and n=numberic) any advice would be greatly appreciated! Quote
SonicBoomAu Posted October 23, 2005 Posted October 23, 2005 You could use the old VB6 method of masked textbox. Or you could use validation when the user leave that field. Hope this helps Quote Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -- Rick Cook, The Wizardry Compiled
Nate Bross Posted October 23, 2005 Posted October 23, 2005 I am assuming you need the date in that format to put in a report of somesort. I would let the user put the date in however they want to, and convert it before you generate the report, or put the data in the database, or whathave you. If IsDate(YourTextBox.Text) Then Format(YourTextBox.Text, "mm/dd/yyyy") End If I don't know, but you would probably need to write a custom function to do the second validation. Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Administrators PlausiblyDamp Posted October 23, 2005 Administrators Posted October 23, 2005 Could you not use something like the DateTime picker control rather than a textbox? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
jalo Posted October 24, 2005 Author Posted October 24, 2005 SonicBoomAu, i am not familiar with masked textboxes but it sounds like what i need - however i am reading here this is not supported in .Net - so how do i deal with that? what is the name of the event i need to handle that is for validation upon the user leaving the field? thanks for advice... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.