In my form have a text box...My requirement is... when is type characters in that box... before typing the 3rd character the space should come automatically or programmatically...the sturucture is look like 21 33 44 55..pls help me...Thanks in Advance.

You may want to try the MaskedTextBox. It allows you to specify a mask to use in the control. Also, this will be smoother for handling things like editing in the control (backspaces, user clicking in the middle of the text and making changes, etc.) To set the mask, do this:

myMaskedControl.Mask = "00 00 00 00";

This will allow the user to enter 4 groups of digits, separated by spaces.

See the MSDN doc for additional explanation of the characters you can use in the mask, e.g., allowing the user to enter letters, etc.

http://msdn.microsoft.com/en-us/library/1fkc1cz6.aspx

Very much Thanks for timely help.Its working fine.. when running the form, the masked TB shows 4 ifines like _ _ _ _ . is it possible to disable these ifines?

You may want to try the MaskedTextBox. It allows you to specify a mask to use in the control. Also, this will be smoother for handling things like editing in the control (backspaces, user clicking in the middle of the text and making changes, etc.) To set the mask, do this:

myMaskedControl.Mask = "00 00 00 00";

This will allow the user to enter 4 groups of digits, separated by spaces.

See the MSDN doc for additional explanation of the characters you can use in the mask, e.g., allowing the user to enter letters, etc.

http://msdn.microsoft.com/en-us/library/1fkc1cz6.aspx

Very much Thanks for timely help.Its working fine.. when running the form, the masked TB shows 4 ifines like _ _ _ _ . is it possible to disable these ifines?

Change the property "PromptChar" - it is currently set to the underscore character. Change this to a space and you should be good.

Change the property "PromptChar" - it is currently set to the underscore character. Change this to a space and you should be good.

ya its working good... still my requirement is not complete... masked textbox should accepts hexa decimal....accepts both integer(0-9) and character(A-f or a-f)...the format look like 0a 1b 22 d4....pls help me.. thanks in advance....

In the Mask property, use the "a" character instead of "0". This will allow alphanumerics (a-z, A-z, 0-9). Be sure the "ASCIIOnly" property is false, otherwise it will not allow you to enter the numbers (it defaults to false).

See the link I posted in an earlier post to see all of the options you can use for the control.

In the Mask property, use the "a" character instead of "0". This will allow alphanumerics (a-z, A-z, 0-9). Be sure the "ASCIIOnly" property is false, otherwise it will not allow you to enter the numbers (it defaults to false).

See the link I posted in an earlier post to see all of the options you can use for the control.

Thanks .Half of the my requirement has completed. but it accepts (a-f, A-F, 0-9)only instead of (a-z, A-z, 0-9).Is any other way there to achieve my requirement exactly? And more over,if the mask is aa aa aa aa . i can enter only 4 pairs...the length is fixed.. if i want to enter n number of pairs... how to achieve this?

In the Mask property, use the "a" character instead of "0". This will allow alphanumerics (a-z, A-z, 0-9). Be sure the "ASCIIOnly" property is false, otherwise it will not allow you to enter the numbers (it defaults to false).

See the link I posted in an earlier post to see all of the options you can use for the control.

one more problem. The mask property is like aa aa aa aa. the mouse cursor is not setting the initial character automatically,when i click the mask text box unlike normal text box...pls help me..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.