473,395 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Help on C# MaskedTextBox

navanova
Hi Guys, the masked text box in my C# application has a customed format as >LLL/LL/LL/000/0/0000/0000. When the application loads it will be like ( / / /
/ / / ). The user can insert any characters in the first 7 blank spaces (in the place of L's) and it will allow any numbers in the remaining 12 blank
spaces (in the place of 0's). When the user finishes inserting, the masked text box displays something like ABC/DE/FGH/012/3/4567/8900.

However i want to make a restriction on the first 3 characters(ABC). I want the application to insert the first 3 charactes (i.e ABC to be some other pre-defined character, say CHW and the user is expected to fill the remaining.)
Can anybody help me on this?

Thanks,
Jul 11 '08 #1
3 4980
tlhintoq
3,525 Expert 2GB
The small amount I've done with masked text boxes is for times. Limiting to "24:00" for example.

I've always just set the text property of the box when the program starts and reads the saved value.

Have you tried just setting the text of the box to "CMW" and letting the user take it from there?
Jul 12 '08 #2
The small amount I've done with masked text boxes is for times. Limiting to "24:00" for example.

I've always just set the text property of the box when the program starts and reads the saved value.

Have you tried just setting the text of the box to "CMW" and letting the user take it from there?
What I want is, the application that i've developed will be used by a number of users. the first three letters of the masked text box shows the code of the user. The application gets the code of the user when the user first logs in (From Username & Password). Thus, once the system recognizes the specific user, it will insert the user code on the first part of the masked text box. Therefore, the user is not asked to insert his/her code every time they logs in.What I want to do is this.

If this is not clear, i'm more than happy to elaborate it again.

Thanks,
Jul 14 '08 #3
tlhintoq
3,525 Expert 2GB
What I want is, the application that i've developed will be used by a number of users. the first three letters of the masked text box shows the code of the user. The application gets the code of the user when the user first logs in (From Username & Password). Thus, once the system recognizes the specific user, it will insert the user code on the first part of the masked text box. Therefore, the user is not asked to insert his/her code every time they logs in.What I want to do is this.

If this is not clear, i'm more than happy to elaborate it again.

Thanks,
That makes sense. And sounds like what I described. For me, when I read the shutdown time property I stick it in the masked text box's .Text property. You'll do the same when you read/receive/calculate the user code based on their Username and Password.

If your Username is "ClintXYZ" and your code is the last three letters of the username then after you get the user to log in set the text of the maskedtextbox, something like this...

myMaskedTextBox.Text = szUsername.substring(szUsername.length-4,3);

The reason for the -4 is because the string itself is zero-based, so for the X which is the 6th character it is in position 5 of the string.

How you calculate your 3 digit code is up to you. This is just for concept.

Another approach would be to not worry about putting the usercode into the text box. After all, do you really need to? You already know what the usercode is. So let the user input everything else, then combine the known usercode to the userinput before you do something with it.
Jul 16 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Mauricio C Vidotto | last post by:
I have an application that use MaskedTextBox Control. This control has Mask property value 9999999.99 and I would like to add numeric values with 2 decimal places. However, if I set Text property...
0
by: dumbo | last post by:
I do not succeed to modify the content of a MaskedTextBox control whose Property "OutputText" is in binding with field of type text of one table in database a MDB. The control has been generated...
1
by: Matt | last post by:
I recently came across what I believe to be a peculiar bug with Mdi Children, and wanted to see if anyone else had experienced this before sending it in. The issue is as follows: I have a number...
2
by: Jaime Rios | last post by:
Hi, I'm using C# to create a printable form. The data is coming from a XML source that I load when the application starts. I have no problems loading the data, but I am having a hard time figuring...
1
by: Jazer | last post by:
Hi, I have a problem with MaskedtextBox. When I 'am trying to insert value 1.5 (single type) into MaskedTextBox, the value on it is shown as 15__,_. Mask is #90.9 The result should be ___1,5...
2
by: sklett | last post by:
Hi, I'm trying to define a mask for a MaskedTextBox and can't get it right. For 5 numbers, '00000' seems to be a valid mask and behaves correctly, but I know need a control that will take a...
0
by: kryptomoon | last post by:
I have a KeyPress event handler for a MaskedTextBox control. According to the event documentation, if I set e.Handled to 'true' it should discard the input character, but it doesn't. After the...
3
by: Mike Fellows | last post by:
I have a few masked textboxes within my application and I have the same problem with each and everyone If I tab to a masked textbox i have no issues, but when i click into a mask textbox the...
0
by: =?Utf-8?B?Sm9hY2hpbQ==?= | last post by:
Can you make the MaskedTextbox to only allow certain letters e.g. 10:11 A (Only allow A and P as input) ?? I don't want any other letters than A or P to appear in the text box. I mean no...
1
by: eljainc | last post by:
Hello, I am trying to utilize a MaskedTextBox control on my form. I would like the user to enter numbers only (i.e. 65000), I set the Mask property as 999999 and the PromptChar as space (it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.