GrapeCity MultiRow Windows Forms Documentation
Mask Property
Example 


Gets or sets the input mask to use at run time.
Syntax
<EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.MaskPropertyEditor,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<SRCategoryAttribute("Behavior")>
<LocalizableAttribute(True)>
<SRDescriptionAttribute("Indicates a string that determines whether the input is allowed for this Cell.")>
<RefreshPropertiesAttribute(RefreshProperties.Repaint)>
<DefaultValueAttribute()>
<MergablePropertyAttribute(False)>
Public Property Mask As String
Dim instance As MaskedTextBoxCell
Dim value As String
 
instance.Mask = value
 
value = instance.Mask
[Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.MaskPropertyEditor,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[SRCategory("Behavior")]
[Localizable(true)]
[SRDescription("Indicates a string that determines whether the input is allowed for this Cell.")]
[RefreshProperties(RefreshProperties.Repaint)]
[DefaultValue()]
[MergableProperty(false)]
public string Mask {get; set;}

Property Value

A System.String that represents the current mask. The default is String.Empty, which means to allow any input.
Exceptions
ExceptionDescription
System.ArgumentExceptionThe string supplied to the Mask property is not a valid mask. Invalid masks include masks containing non-printable characters.
Remarks
Refer to MaskedTextBox.Mask in MSDN.
Example
The following code example shows how to use the masked text box cell to control input format.
private void Form1_Load(object sender, EventArgs e)
        {
            MaskedTextBoxCell jpDateMaskedTextBoxCell = new MaskedTextBoxCell();

            jpDateMaskedTextBoxCell.Mask = "AA00年90月90日 90時90分";

            jpDateMaskedTextBoxCell.Size = new Size(170, 21);

            MaskedTextBoxCell postalcodeMaskedTextBoxCell = new MaskedTextBoxCell();

            postalcodeMaskedTextBoxCell.Mask = "000-0000";

            postalcodeMaskedTextBoxCell.Size = new Size(60, 21);

            Cell[] cells = new Cell[] { jpDateMaskedTextBoxCell, postalcodeMaskedTextBoxCell };

            Template template1 = Template.CreateGridTemplate(cells);

            template1.ColumnHeaders[0][0].Value = "日付と時間(和暦、日本語)";
            template1.ColumnHeaders[0][1].Value = "郵便番号";

            gcMultiRow1.Template = template1;
            gcMultiRow1.RowCount = 3;

            gcMultiRow1[0, 0].Value = "平成11年06月03日 09時30分";
            gcMultiRow1[0, 1].Value = "182-0021";
        }
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim jpDateMaskedTextBoxCell As New MaskedTextBoxCell()

        jpDateMaskedTextBoxCell.Mask = "AA00年90月90日 90時90分"

        jpDateMaskedTextBoxCell.Size = New Size(170, 21)

        Dim postalcodeMaskedTextBoxCell As New MaskedTextBoxCell()

        postalcodeMaskedTextBoxCell.Mask = "000-0000"

        postalcodeMaskedTextBoxCell.Size = New Size(60, 21)

        Dim cells As Cell() = New Cell() {jpDateMaskedTextBoxCell, postalcodeMaskedTextBoxCell}

        Dim template1 As Template = Template.CreateGridTemplate(cells)

        template1.ColumnHeaders(0)(0).Value = "日付と時間(和暦、日本語)"
        template1.ColumnHeaders(0)(1).Value = "郵便番号"

        gcMultiRow1.Template = template1
        gcMultiRow1.RowCount = 3

        gcMultiRow1(0, 0).Value = "平成11年06月03日 09時30分"
        gcMultiRow1(0, 1).Value = "182-0021"
    End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

MaskedTextBoxCell Class
MaskedTextBoxCell Members

 

 


Copyright © GrapeCity, inc. All rights reserved.