HeaderPane
Main
Hide
Share Link
Print

Cultures

The SftMask.Culture property defines the culture whose conventions the control follows. When it is null (the default), the control uses the current culture of the thread at the time the control is created.

ConventionUsed for
Decimal separatorThe fraction digits of decimal fields; typing it starts the fraction digits.
Group separator and group sizesThe digit grouping of numeric fields defined with the , subtoken, such as 1,234,567 (en-US), 1.234.567 (de-DE), 1'234'567 (de-CH), 12,34,567 (hi-IN) or 1 234 567 (fr-FR, with a narrow space that many fonts draw only one or two pixels wide).
Currency symbolThe | token of a mask, and the label "|", which is shown on the side where the culture puts the currency symbol (see Label).
Date and time separatorsThe / and : tokens of a mask.
CasingThe uppercase and lowercase blocks (<u and <l) convert characters with the culture's casing rules.

Changing the culture rebuilds the mask with the new separators: numeric fields keep their values and the other input positions their characters. A program that sets numbers through the SftMask.Value property, rather than through the SftMask.Text property, works the same in every culture.

C#

sftMask1.Mask = "$^C-,8.2";
sftMask1.Culture = CultureInfo.GetCultureInfo("de-DE");
sftMask1.Value = 1234.5m;    // shows 1.234,50

VB

SftMask1.Mask = "$^C-,8.2"
SftMask1.Culture = CultureInfo.GetCultureInfo("de-DE")
SftMask1.Value = 1234.5D    ' shows 1.234,50

The digits 0 to 9 are used in every culture; digits of other scripts typed into a numeric field are entered as these digits (see Numeric Fields).