473,385 Members | 2,015 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,385 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 2495
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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
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,...

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.