Disallow entry from numeric keyboard to custom date textbox and pass entry to textbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EgoSum
    New Member
    • Mar 2007
    • 20

    Disallow entry from numeric keyboard to custom date textbox and pass entry to textbox

    Can someone help me with custom text box?

    I want change behavior custom date text box - disallow entry and pass entry from numeric keyboard to a text box. Code below disallow entry, but how I can pass entry?

    Code:
    public class myDateTextBox : AMS.TextBox.DateTextBox
    {[INDENT]protected override bool ProcessDialogKey(Keys keyData)
    {[INDENT]if (keyData >= Keys.NumPad0 && keyData <= Keys.NumPad9)
    {[INDENT]base.ProcessDialogKey(keyData);
    return true;[/INDENT]
    }[/INDENT]
    return base.ProcessDialogKey(keyData);
    }[/INDENT]
    }

    I try something like this, but it dosen't work.

    Code:
    public class x
    { // ...[INDENT]private void textBox_KeyDown(object sender, KeyEventArgs e)
    {[INDENT]if (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9)
    {[INDENT]textBox.Text = Convert.ToString(e.KeyData);[/INDENT]
    }[/INDENT]
    }[/INDENT]
    }
    Thanks in advance for any help.
    Last edited by kenobewan; Mar 12 '07, 12:50 PM. Reason: Add code tags
Working...