Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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!

Posted

You could use the old VB6 method of masked textbox.

 

Or you could use validation when the user leave that field.

 

Hope this helps

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

Posted

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.

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...