SpinEditor - Null Text

2 posts, 0 answers
  1. Doug
    Doug avatar
    50 posts
    Member since:
    Jul 2012

    Posted 28 Feb 2013 Link to this post

    Is there a way to clear the value in a SpinEditor?  I want to be able to press the delete key and clear the value from the textbox and also programmatically clear it.  Something like what you showed me for a DateTimePicker:

    dtpFilter1.NullableValue = null;
    dtpFilter1.NullDate = System.Convert.ToDateTime("01/01/0001");
    dtpFilter1.NullText = "";

    Thank you,
  2. Peter
    Peter avatar
    1148 posts

    Posted 01 Mar 2013 Link to this post

    Hi Gary,

    Thank you for the question.

    You should handle the KeyDownEvent and clear the text from the hosted TextBoxItem. 
    Please, refer to the code below:
    private void Form1_Load(object sender, EventArgs e)
        this.radSpinEditor1.SpinElement.TextBoxItem.NullText = "NULL TEXT";
        this.radSpinEditor1.KeyDown += new KeyEventHandler(radSpinEditor1_KeyDown);
    void radSpinEditor1_KeyDown(object sender, KeyEventArgs e)
        if (e.KeyData == Keys.Delete)
            this.radSpinEditor1.SpinElement.TextBoxControl.Text = "";
    private void radButton1_Click(object sender, EventArgs e)
        this.radSpinEditor1.SpinElement.TextBoxControl.Text = "";

    Bear in mind that the control will display the Null Text only if it does not contain focus.

    I hope this helps. Regards,
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Join us for a FREE webinar to see all the new stuff in action.

    Interested, but can’t attend? Register anyway and we’ll send you the recording.
  3. DevCraft R3 2016 release webinar banner
Back to Top