Re: Data Validation in C#

  • From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 29 Apr 2010 07:06:09 +0100

Hi Celia,

I don't know the answer to that. It's not something I've ever tried to do. As I said, I can't actually get the MaskedTextBox to accept invalid data; it just beeps and then continues to wait for a valid input. I imagine that if you want error messages, you will have to use a normal TextBox and write all the checking code yourself.

 Corrections welcome,

 Martin


----- Original Message ----- From: "Celia Rodriguez" <celia-rodriguez@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Wednesday, April 28, 2010 11:29 PM
Subject: RE: Data Validation in C#


Hi Martin,

Thank you for the info.  One more thing, is it possible to issue an error
message when the mask box encounters invalid data?
Thank you,
Celia
-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Martin Slack
Sent: Wednesday, April 28, 2010 8:25 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: Data Validation in C#

Hi Celia,

 If you are using the Visual Studio Express C# IDE, you need to select a
MaskedTextBox from the Toolbox.  When this has been placed on the form, F4
will bring up the properties window, and you look for the property Mask.
Tab across and activate the drop down list, and you will find a number of
different formats for the mask.  If you can find a suitable one, then at
runtime the box will only accept numerical inputs: if you attempt to enter
an alphabetic character, there will just be a beep and nothing extra will
appear in the input, in other words, the component itself does the checking.

 hth

Martin


----- Original Message ----- From: "Celia Rodriguez" <celia-rodriguez@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Wednesday, April 28, 2010 11:28 AM
Subject: Data Validation in C#


Hi Everyone,

I have a very simple question.  I hope someone can help.

If I have a textbox with "0077" and I want to validate this as
alphanumberic
Because I don't want to lose the zeroes.
What would be the best way to do this.
Can I do this in a try/catch block?
Or can I do this in a maskBox and How do I set it up ?

Thank you in advance,


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

  • Follow-Ups:
    • XML
      • From: Celia Rodriguez

Other related posts: