Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Masked Input in DataGridView
Message
De
11/09/2008 08:16:03
Vijay Kumar
DNS ERP Pvt Ltd
Inde
 
 
À
05/09/2008 18:03:40
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01345274
Message ID:
01346551
Vues:
9
You want to use a MaskedTextBox in your DataGridViewColumn? Here it is. Add a DataGridViewMaskedTextColumn to your DataGridView and set the Mask string. Then you get a MaskedTextBox using this Mask as EditingControl.

Background

The .NET Framework contains for DataGridView columns a standard TextBox only. By data binding, it's no problem to restrict the input to numbers, e.g. TextBox.CharacterCasing can be set by DataGridView.EditingControlShowing event. More complex restrictions are available in MaskedTextBox. Therefore it's useful to host a MaskedTextBox in a DataGridViewColumn.

Using the Code
The MaskedTextColumn solution consists of three combined classes, added by an attribute class.

The ReferencedDescriptionAttribute class is used in the designer to call an existing description. See details here.

The MaskedText classes are included into your own ExtendedControls.dll assembly, or you store the prepared DLL directly. Add a reference to this assembly, and you can use the DataGridViewMaskedTextColumn. You need to use this class only; the DataGridViewMaskedTextCell class and the DataGridViewMaskedTextControl class are used automatically by the framework itself.

Working by Code
Add a DataGridViewMaskedTextColumn to your DataGridView like any other DataGridViewColumn and set the Mask property
Vijay Kumar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform