By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

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

P: 20
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?

Expand|Select|Wrap|Line Numbers
  1. public class myDateTextBox : AMS.TextBox.DateTextBox
  2. {
    protected override bool ProcessDialogKey(Keys keyData)
  3. {
    if (keyData >= Keys.NumPad0 && keyData <= Keys.NumPad9)
  4. {
    base.ProcessDialogKey(keyData);
  5. return true;}return base.ProcessDialogKey(keyData);
  6. }}

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

Expand|Select|Wrap|Line Numbers
  1. public class x
  2. { // ...
    private void textBox_KeyDown(object sender, KeyEventArgs e)
  3. {
    if (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9)
  4. {
    textBox.Text = Convert.ToString(e.KeyData);
    }}}
Thanks in advance for any help.
Mar 12 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.