473,503 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

20 New Member
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. {
  3. protected override bool ProcessDialogKey(Keys keyData)
  4. {
    if (keyData >= Keys.NumPad0 && keyData <= Keys.NumPad9)
  5. {
  6. return true;}return base.ProcessDialogKey(keyData);
  7. }}

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. {
  4. if (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9)
  5. {
  6. textBox.Text = Convert.ToString(e.KeyData);}}}
Thanks for any help.
Mar 14 '07 #1
2 1884
tylerb
8 New Member
Is the datebox in focus when the user is typing? If so then you want the datebox's event handler to pass the numbers to the the textbox rather then the textbox's event handler (that code will not be reached if the datebox is in focus)

Is the disallow working and the passing not working or are they both broken?
Mar 15 '07 #2
EgoSum
20 New Member
Is the datebox in focus when the user is typing? If so then you want the datebox's event handler to pass the numbers to the the textbox rather then the textbox's event handler (that code will not be reached if the datebox is in focus)

Is the disallow working and the passing not working or are they both broken?
Yes, the datebox in focus when the user is typing. I try use the datebox's event handler to pass the numbers to the the textbox, but it does not respond. There's an error in above code, this source is correct:

public class x
{
myDateTextBox order;
TextBox textBox;
// ...
private void order_KeyDown(object sender, KeyEventArgs e) {
if (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9) {
textBox.Text = Convert.ToString(e.KeyData);
}
}
}

The code disallow input number from numeric keyboard in dateTextBox, but the passing to textBox not working.
Mar 15 '07 #3

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

Similar topics

3
4916
by: Phil Schmidt | last post by:
I'm trying to make a custom entry widget, as in the code that follows. There are two problems I'm trying to fix: 1) I would like the widget to behave as myEntry.Escape() does now, except that it...
2
5534
by: Sam | last post by:
Why isn't there a numberBox Windows Form control like a textbox control but for numeric (float) input? There doesn't seem to be any easy or visual solution to this VERY SIMPLE ISSUE in either...
6
3690
by: Altramagnus | last post by:
I have searched throught the newsgroups on how to restrict entry in textboxes, for example, I only want the textbox to only accept numberic. The standard answer is to use the KeyPress event....
1
1705
by: Stephen Adam | last post by:
Hi there people, I'm creating my own set of self validating text boxes. They all inherit from a base text box which simply contains a required field validator, they then usuallly implement...
5
4078
by: ScareCrow | last post by:
How do I go about limiting a textbox to accepting numeric key input from the keyboard in vb.net? --------------= Posted using GrabIt =---------------- ------= Binary Usenet downloading...
1
1249
by: spamfilteraccount | last post by:
Hi, I have a textbox and a listbox and I handle keydown events in the textbox. I'd like to pass page up/down events to the listbox if the focus is on the textbox, so that the default handler of...
0
1239
by: EgoSum | last post by:
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...
4
6923
by: viv | last post by:
how do you trap keyboard codes for text box in VB2005 ? I'm looking for a code snippet to only allow numeric input in a text box (same as Key event in VB6, then use Keyascii to decide action) ...
4
2972
by: Rex the Strange | last post by:
Hello all, Can anyone please tell me why I can't do this (and what I can do to get the equivalent effect): In the code: public enum myenum value1 value2
0
7204
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5018
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1516
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.