473,659 Members | 3,494 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 1894
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(o bject sender, KeyEventArgs e) {
if (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9) {
textBox.Text = Convert.ToStrin g(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
4926
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 happens on loss of focus, not when pressing Esc. 2) TABbing between multiple entry fields does undesired things with the selection, and with cursor placement. Can anyone offer any suggestions for how to fix this? I'm attemting to
2
5548
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 version of Visual Studio. I simply wanted to create a Windows app where a user could enter miles or kilometers, gallons or liters, and see the other in the adjacent box. The form was easy but the textbox control would not let me cast any number of...
6
3710
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. However, this do not address the paste event User is still able to copy and paste any characters. How do I create a textbox so that regardless what I do ( including cut and paste ),
1
1712
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 another validator to check they contain number, currencies, dates or whatever. The problem i'm having is with the DateTextBox, I have created my own Date Validator which inherits from the BaseValidator class which the DateTextBox uses. My problem is...
5
4082
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 made easy =--------- -= Get GrabIt for free from http://www.shemes.com/ =-
1
1258
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 the listbox handles them. That is I want to be able to scroll the listbox from the keyboard even if current keyboard focus is on the textbox. How can I do that?
0
1251
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 pass entry? public class myDateTextBox : AMS.TextBox.DateTextBox { protected override bool ProcessDialogKey(Keys keyData) {if (keyData >= Keys.NumPad0 && keyData <= Keys.NumPad9) {base.ProcessDialogKey(keyData); return true;
4
6945
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) can anyone provide a snippet of code please many thanks
4
2981
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
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7359
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1739
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.