HeaderPane
Main
Hide
Share Link
Print

Sample1 Sample (C#)

This sample illustrates various Masked Edit controls.

The source code is located at C:\Program Files (x86)\Softelvdm\SftMask OCX 8.0\Samples\Visual Studio - CSharp\Sample1\Form1.cs.


        private void Form1_Load(object sender, System.EventArgs e)
        {
            foreach (Control c in Controls) {
                AxSftMaskLib80.AxSftMask mask = c as AxSftMaskLib80.AxSftMask;
                if (mask != null) {
                    mask.DarkMode = SftMaskLib80.SftMaskDarkModeConstants.darkSftMaskAuto; // follow the Windows dark mode setting
                    mask.HighContrastMode = SftMaskLib80.SftMaskHighContrastConstants.highContrastSftMaskAuto; // follow the Windows High Contrast setting
                }
            }

            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, AxSftMaskLib80._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 11/15/2026 - (email)
© 2026 Softel vdm, Inc.