Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

Sample1 Sample (C#)

This sample illustrates various Masked Edit controls.

The source code is located at C:\Program Files (x86)\Softelvdm\SftMask OCX 7.0\Samples\Visual Studio - CSharp\Sample1\Form1.cs or C:\Program Files\Softelvdm\SftMask OCX 7.0\Samples\Visual Studio - CSharp\Sample1\Form1.cs (on 32-bit Windows versions).

private void Form1_Load(object sender, System.EventArgs e)
{
    SftMaskPhone.Text = "9415058600"; // our phone number
    SftMaskPhone.EntrySelect = SftMaskEntrySelectConstants.entrySftMaskSelectHome; // set the input location
    SftMaskSSN.Text = "444-12-1111"; // a social security number
    SftMaskToday.Contents.DateTime = System.DateTime.Now; // set today's date
    SftMaskTime.Contents.DateTime = System.DateTime.Now;
    SftMaskPercent.Contents.set_Value(0, 50); // start with 50 percent
    SftMaskAmount.Text = "199";
    SftMaskIPAddr.Text = "209.61.201.49";
}

private void Command1_Click(object sender, System.EventArgs e)
{
    Application.Exit();
}

private void SftMaskAmount_UpDownPress(object sender, AxSftMaskLib70._ISftMaskEvents_UpDownPressEvent e)
{
    double amount;
    double increment;
    if (e.counter == 0 || e.counter > 5) {
        amount = Convert.ToDouble(e.field);
        increment = 0.01;
        if (e.counter > 14) increment = 0.1;
        if (e.counter > 23) increment = 1;
        if (e.counter > 52) increment = 10;
        if (e.up)
            amount = amount + increment;
        else
            amount = amount - increment;
        if (amount > 99999.99) amount = 99999.99;
        if (amount < -99999.99) amount = -99999.99;
        e.field = amount.ToString("N2");
    }
}

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