HeaderPane
Main
Hide
Share Link
Print

Using SftMask/NET with .NET Framework

The control is automatically added to your Toolbox in Visual Studio and is automatically registered in the GAC (Global Assembly Cache) during installation of SftMask/NET. Please see Distributing SftMask/NET for information on how to distribute the control with your application.

.NET 10 projects use the control through its NuGet package, see Using SftMask/NET with .NET 10.

Adding SftMask/NET To A Form

You can add an SftMask control to a form by dragging it from the Toolbox to the form.

If the control is missing from the Toolbox, please see "Manually Adding .NET Components To The Toolbox".

Adding SftMask to a form

Once the control has been added to the form, you can access its property pages, product updates and product support page on the web using the control's smart tag. Edit Properties opens the property pages; Define Mask..., Calculator... and AutoComplete... open them on the Mask, Calculator and AutoComplete pages. The Mask page offers predefined masks and a field to try the mask.

SftMask Tasks

Place a Label in front of each field, with a text such as "&Amount:". Screen readers use it as the field's name and its mnemonic moves the input focus to the field (see Accessibility).

In this example, we'll set up an amount field with the popup calculator in code and show its value in the form's caption.

VB

Imports Softelvdm.SftMaskNET

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SftMask1.Mask = "$^C-,8.2"
        SftMask1.Label = "|"
        SftMask1.TextAlign = HorizontalAlignment.Right
        SftMask1.ButtonStyle = ButtonStyleEnum.UpDown
        SftMask1.Value = 125D
    End Sub

    Private Sub SftMask1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SftMask1.ValueChanged
        Text = SftMask1.Text
    End Sub
End Class

C#

using System;
using System.Windows.Forms;

using Softelvdm.SftMaskNET;

namespace WindowsApplication1 {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e) {
            sftMask1.Mask = "$^C-,8.2";
            sftMask1.Label = "|";
            sftMask1.TextAlign = HorizontalAlignment.Right;
            sftMask1.ButtonStyle = ButtonStyleEnum.UpDown;
            sftMask1.Value = 125m;
            sftMask1.ValueChanged += sftMask1_ValueChanged;
        }

        private void sftMask1_ValueChanged(object sender, EventArgs e) {
            Text = sftMask1.Text;
        }
    }
}

This control has many properties and methods which you can use. This is a very simple example and doesn't even begin to exploit its capabilities. Please take a moment to familiarize yourself with the classes and objects offered by SftMask/NET. Also make sure to run the demo which is included with this product and take a look at the included samples.