473,396 Members | 2,037 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,396 software developers and data experts.

How to control user from character keys

Hi,

I want to control the user using character keys in a numeric text box. So,
I'm differentiating with Tag Property, I'm storing Tag Value = "I" for
integer, "F" for currency/float.

Any Code sample in vb.NET ?

Regards
Yameen
Jul 21 '05 #1
3 3711
With Deft Fingers, "ItsMe" <it*******@yahoo.com> wrote:
I want to control the user using character keys in a numeric text box. So,
I'm differentiating with Tag Property, I'm storing Tag Value = "I" for
integer, "F" for currency/float.


If I am reading you right, try playing with this... I had a TextBox in which I
wanted the user to ONLY enter numbers. Nothing else. This does the trick.
You will just have to play with the AscW(e.KeyChar) values somewhat.
Private Sub tbxCblDist_KeyPress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles tbxCblDist.KeyPress
' Allow ONLY Numeric Entries
If ((AscW(e.KeyChar) < 48) Or (AscW(e.KeyChar) > 57)) And Not _
(AscW(e.KeyChar) = 8) Then e.Handled = True
End Sub
Hopefully this is usefull.

Regards,

Bruce
Jul 21 '05 #2
Thank you very much Bruce, I got it.

Cheers
"Mr. B" <Us**@NoWhere.Com> wrote in message
news:op********************************@4ax.com...
With Deft Fingers, "ItsMe" <it*******@yahoo.com> wrote:
I want to control the user using character keys in a numeric text box. So,I'm differentiating with Tag Property, I'm storing Tag Value = "I" for
integer, "F" for currency/float.
If I am reading you right, try playing with this... I had a TextBox in

which I wanted the user to ONLY enter numbers. Nothing else. This does the trick. You will just have to play with the AscW(e.KeyChar) values somewhat.
Private Sub tbxCblDist_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles tbxCblDist.KeyPress
' Allow ONLY Numeric Entries
If ((AscW(e.KeyChar) < 48) Or (AscW(e.KeyChar) > 57)) And Not _
(AscW(e.KeyChar) = 8) Then e.Handled = True
End Sub
Hopefully this is usefull.

Regards,

Bruce

Jul 21 '05 #3
how can i move the cursor to the next tabindex ?? I've written like this,
but it doesn't work ?

If (AscW(e.KeyChar) = 13) Then

SendKeys.Send("{Tab}")

End If

Any other better way ?

"Mr. B" <Us**@NoWhere.Com> wrote in message
news:op********************************@4ax.com...
With Deft Fingers, "ItsMe" <it*******@yahoo.com> wrote:
I want to control the user using character keys in a numeric text box. So,I'm differentiating with Tag Property, I'm storing Tag Value = "I" for
integer, "F" for currency/float.
If I am reading you right, try playing with this... I had a TextBox in

which I wanted the user to ONLY enter numbers. Nothing else. This does the trick. You will just have to play with the AscW(e.KeyChar) values somewhat.
Private Sub tbxCblDist_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles tbxCblDist.KeyPress
' Allow ONLY Numeric Entries
If ((AscW(e.KeyChar) < 48) Or (AscW(e.KeyChar) > 57)) And Not _
(AscW(e.KeyChar) = 8) Then e.Handled = True
End Sub
Hopefully this is usefull.

Regards,

Bruce

Jul 21 '05 #4

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

Similar topics

3
by: Jerome Terry | last post by:
Hi, Why don't UserControl's received Key events for the arrow keys? Further, when a user control is added to a Form, why does the form stop receiving Key events for the arrow keys? I have tried...
3
by: Carmen de Lara | last post by:
hello to all, I found in Internet the following code that is very usefull to me. The code detects any character that is entered to datagrid, I am interested in the control key F2 but I don't know...
10
by: Dennis D. | last post by:
Hello: There are a series of textboxes (x.text, y.text, z.text etc.) in which user input is expected. As: dtmX=CDate(x.text) dtmY=CDate(y.text) dtmZ=CDate(z.text) where x, y, and z.text...
3
by: ItsMe | last post by:
Hi, I want to control the user using character keys in a numeric text box. So, I'm differentiating with Tag Property, I'm storing Tag Value = "I" for integer, "F" for currency/float. Any Code...
11
by: Ron L | last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the data it scans comes through as if it was typed on a keyboard. I am trying to have the data in the barcode be displayed in...
1
by: Martijn Mulder | last post by:
/* I have problems detecting the Arrow Keys on a User Control. A control derived from System.Windows.Forms.Control neglects 'bare' Arrow Keys but does react on the combination <Altor <Ctrl+ Arrow...
17
by: Kbalz | last post by:
I'm developing a Wizard type program, and I'm flipping between steps by using a TabControl.. buttons on each tabPage move to the next or previous tabPage. When I press CTRL+Tab however, the...
2
by: Jenifer.Austin | last post by:
MS Access 2000 I have created a large treeview control based on lists of parts. The nodekey for a part consists of a character followed by the parent part's index. Some of these parts (e.g.,...
2
by: Charles Law | last post by:
I'll kick myself when you tell me, but ... I have a user control on a form, and I want the user control to see the arrow keys when I press them. If I press just about any other key the control's...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
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...

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.