ComponentOne Input for WinForms
Spin Up/Spin Down Programmatically
Input for WinForms Task-Based Help > Spin Up/Spin Down Programmatically

The SpinUp and SpinDown methods enable you to increase or decrease the values entered in the C1Input controls (C1ComboBox, C1DropDownControl, C1DateEdit and C1NumericInput) when the focus is not on the control.

In addition to the above methods, C1ComboBox and C1DateEdit contain an additional property AllowSpinLoop that, when set to true, loops through the items when the SpinUp or SpinDown method is invoked.

Following is an example to use the SpinUp method:

  1. Create a new Windows Application project. Place a C1NumericEdit control on the form.
  2. From the Properties window, set the Value property to 0.
  3. Add a textbox control onto the form and double click the textbox to generate the TextChanged event, in code.
  4. Add the following code to the textbox's TextChanged event.

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
    
          c1NumericEdit1.SpinUp(1)  
    
    End Sub
    

    To write code in C#

    C#
    Copy Code
    private void textBox1_TextChanged(object sender, EventArgs e)
    {
    c1NumericEdit1.SpinUp(1);
    }
  5. Run the project.

What You've Accomplished

When you enter characters into the textbox control, the value in the C1NumericEdit control will increase by 1, each time a new character is entered, giving you the count of characters entered in the control.

See Also