473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

txtbox not getting a key

Hi,

I'm using a key down event to avoid my txtbox show any
other character different from a number:

private void tbxErrorId_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
// if is not a number
if(e.KeyValue<48 || e.KeyValue>57)
{
// what to do here for not to
// show the wrong character
}

}

Help

Regads.
Nov 15 '05 #1
2 2496
private void textBox1_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)

{

if (!Char.IsDigit(e.KeyChar))

{

e.Handled = true;

}

}

"Cosh" <jl*****@realitysw.com> wrote in message
news:6b****************************@phx.gbl...
Hi,

I'm using a key down event to avoid my txtbox show any
other character different from a number:

private void tbxErrorId_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
// if is not a number
if(e.KeyValue<48 || e.KeyValue>57)
{
// what to do here for not to
// show the wrong character
}

}

Help

Regads.

Nov 15 '05 #2
private void textBox1_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)

{

if (!Char.IsDigit(e.KeyChar))

{

e.Handled = true;

}

}

"Cosh" <jl*****@realitysw.com> wrote in message
news:6b****************************@phx.gbl...
Hi,

I'm using a key down event to avoid my txtbox show any
other character different from a number:

private void tbxErrorId_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
// if is not a number
if(e.KeyValue<48 || e.KeyValue>57)
{
// what to do here for not to
// show the wrong character
}

}

Help

Regads.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Koen | last post by:
Hi, I have three objects in my form: a listbox (lstform) a subform (fsub) a txtbox (txt) The listbox lists form names that will be displayed in the subform. To do this I use the...
2
by: DD | last post by:
I have a subform on a form In the subform i have a chkBox= and a txtbox= The idea is you Chk and the price $40.00 is automaticly entered into The chkBox has code Private Sub...
0
by: Paul T. Rong | last post by:
There is a txtbox (time) in a switchboard, I would like to make the time txtbox visible all the time (some big forms block off the time txtbox). Thanks in advance. Paul, Bratislava, Slovakia
0
by: Cosh | last post by:
Hi, I'm using a key down event to avoid my txtbox show any other character different from a number: private void tbxErrorId_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { //...
3
by: IceColdFire | last post by:
Hi, I am using statements of type TxtBox.Text="Hello \n Hi" But they appear in same line with special character. How to make display in TextBox in different lines.... Thanks C# Pro
2
by: Boki | last post by:
Hi All, // code start alert("document.all.txtbox"+valueA+".value") // end code could you please advice, can it show the value of txtbox ?
18
by: cipher2079 | last post by:
how can I use two txtbox to enter aphanumeric value and taking the first value of the textbox and placing it in the second txtbox with the numbers value being change to the actual wording (1,2...
2
by: ebasshead | last post by:
Hi Everybody, I have a txtbox that populates itself when the start of the form is filled out. But sometimes I have to change the info in that specific txtbox. At the moment it wont allow me to. Is...
1
by: mailbox73 | last post by:
Hi, c# 2008 express edition. Can anyone please help me figure out why I cannot get any value from one form to another when the controls are databound. (the formY.txtbox lands up empty) in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.