Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

CenturyBreak Property, SftMaskCalendar Object

Defines the year where a higher 2-digit year indicates the previous century.

Syntax

Get

VB.NETYear = object.CenturyBreak As Integer
VBYear = object.CenturyBreak As Long
C#.NETint Year = object.CenturyBreak;
VC++long Year = object->CenturyBreak;
long Year = object->GetCenturyBreak();
CHRESULT object->get_CenturyBreak(long* Year);

Put

VB.NETobject.CenturyBreak = Year As Integer
VBobject.CenturyBreak = Year As Long
C#.NETint object.CenturyBreak = Year;
VC++long object->CenturyBreak = Year;
void object->PutCenturyBreak(long Year);
CHRESULT object->put_CenturyBreak(long Year);

object

A SftMaskCalendar object.

Year

Defines the year where a higher 2-digit year indicates the previous century. If -1 is specified, the current year plus 30 is considered the break value.

Comments

The CenturyBreak property defines the year where a higher 2-digit year indicates the previous century.

This value is used when a date without century is entered (i.e., a two digit year). The correct century is determined based on the CenturyBreak property. Any two digit year greater or equal to the CenturyBreak value is assumed to be in the prior century.

Examples

VB.NET

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    AxSftMask1.Mask = "$d"
    AxSftMask1.Calendar.CenturyBreak = 50
    ' 00-49 is 20xx  50-99 is 19xx
    AxSftMask1.Alignment = SftMaskAlignConstants.alignSftMaskRight
    AxSftMask1.EditStyle = SftMaskEditStyleConstants.editSftMaskCalendarDropDown
    AxSftMask1.AutoAdvance = True
    AxSftMask1.TabAdvance = True
    AxSftMask1.Caption.Text = "&Ship Date"
    AxSftMask1.Caption.Alignment = SftMaskAlignConstants.alignSftMaskCenter
    AxSftMask1.Caption.Position = SftMaskPositionConstants.positionSftMaskTop
    AxSftMask1.Contents.DateTime = #1/1/2007#
    AxSftMask1.Caption.BackColor = Convert.ToUInt32(ColorTranslator.ToOle(SystemColors.Highlight) And &HFFFFFFFF&)
    AxSftMask1.Caption.ForeColor = Convert.ToUInt32(ColorTranslator.ToOle(SystemColors.HighlightText) And &HFFFFFFFF&)
    AxSftMask1.AutoSize = True
End Sub

VB6

Private Sub Form_Load()
    SftMask1.Mask = "$d"
    SftMask1.Calendar.CenturyBreak = 50
    ' 00-49 is 20xx  50-99 is 19xx
    SftMask1.Alignment = alignSftMaskRight ' edit control
    SftMask1.EditStyle = editSftMaskCalendarDropDown
    SftMask1.AutoAdvance = True
    SftMask1.TabAdvance = True
    SftMask1.Caption.Text = "&Ship Date"
    SftMask1.Caption.Alignment = alignSftMaskCenter
    SftMask1.Caption.Position = positionSftMaskTop
    SftMask1.Contents.DateTime = #1/1/2007#
    SftMask1.Caption.BackColor = vbHighlight
    SftMask1.Caption.ForeColor = vbHighlightText
    SftMask1.AutoSize = True
End Sub

C#

private void Form1_Load(object sender, System.EventArgs e)
{
    axSftMask1.Mask = "$d";
    axSftMask1.Calendar.CenturyBreak = 50;
    // 00-49 is 20xx  50-99 is 19xx
    axSftMask1.Alignment = SftMaskAlignConstants.alignSftMaskRight;
    axSftMask1.EditStyle = SftMaskEditStyleConstants.editSftMaskCalendarDropDown;
    axSftMask1.AutoAdvance = true;
    axSftMask1.TabAdvance = true;
    axSftMask1.Caption.Text = "&Ship Date";
    axSftMask1.Caption.Alignment = SftMaskAlignConstants.alignSftMaskCenter;
    axSftMask1.Caption.Position = SftMaskPositionConstants.positionSftMaskTop;
    axSftMask1.Contents.DateTime = new DateTime(2007, 1, 1);
    axSftMask1.Caption.BackColor = (uint) ColorTranslator.ToOle(SystemColors.Highlight);
    axSftMask1.Caption.ForeColor = (uint) ColorTranslator.ToOle(SystemColors.HighlightText);
    axSftMask1.AutoSize = true;

C++

BOOL CProject1Dlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    m_pMask1 = m_Mask1.GetControlUnknown();
    _ASSERT(m_pMask1 != NULL);

    m_pMask1->Mask = _T("$d");
    m_pMask1->Calendar->CenturyBreak = 50;
    // 00-49 is 20xx  50-99 is 19xx
    m_pMask1->Alignment = alignSftMaskRight;
    m_pMask1->EditStyle = editSftMaskCalendarDropDown;
    m_pMask1->AutoAdvance = VARIANT_TRUE;
    m_pMask1->TabAdvance = VARIANT_TRUE;
    m_pMask1->Caption->Text = _T("&Ship Date");
    m_pMask1->Caption->Alignment = alignSftMaskCenter;

See Also SftMaskCalendar Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.