I have a combobox where a user can select a zoom factor or enter a
zoom factor.
I tried to limit entry into the combobox to numbers only by catching
the keydown event and setting e.handled = true if any non number
characters are entered.
But those characters still appear in the combobox. Is this a combobox
bug?
If yes any workarounds?
Tosch 10 9184
Hi Tosch,
Use the keypress event. The following worked fine for me, disallowing 'a':
If e.KeyChar = "a" Then
e.Handled = True
End If
HTH,
Bernie Yaeger
"Tosch" <to**********@s wissonline.ch> wrote in message
news:18******** *************** *********@4ax.c om... I have a combobox where a user can select a zoom factor or enter a zoom factor. I tried to limit entry into the combobox to numbers only by catching the keydown event and setting e.handled = true if any non number characters are entered. But those characters still appear in the combobox. Is this a combobox bug? If yes any workarounds?
Tosch
Hi Tosch,
Use the keypress event. The following worked fine for me, disallowing 'a':
If e.KeyChar = "a" Then
e.Handled = True
End If
HTH,
Bernie Yaeger
"Tosch" <to**********@s wissonline.ch> wrote in message
news:18******** *************** *********@4ax.c om... I have a combobox where a user can select a zoom factor or enter a zoom factor. I tried to limit entry into the combobox to numbers only by catching the keydown event and setting e.handled = true if any non number characters are entered. But those characters still appear in the combobox. Is this a combobox bug? If yes any workarounds?
Tosch
This is my code and it's not working. I want only numbers 0-9
accepted:
Private Sub ComboBox1_KeyPr ess(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyPressE ventArgs) Handles ComboBox1.KeyPr ess
Select Case e.KeyChar
Case "0" To "9"
Case Else
e.Handled = True
End Select
End Sub
BTW: I'm using VS2002.
Tosch
On Thu, 11 Nov 2004 09:58:23 -0500, "Bernie Yaeger"
<be*****@cherwe llinc.com> wrote: Hi Tosch,
Use the keypress event. The following worked fine for me, disallowing 'a': If e.KeyChar = "a" Then
e.Handled = True
End If
HTH,
Bernie Yaeger
"Tosch" <to**********@s wissonline.ch> wrote in message news:18******* *************** **********@4ax. com...I have a combobox where a user can select a zoom factor or enter a zoom factor. I tried to limit entry into the combobox to numbers only by catching the keydown event and setting e.handled = true if any non number characters are entered. But those characters still appear in the combobox. Is this a combobox bug? If yes any workarounds?
Tosch
This is my code and it's not working. I want only numbers 0-9
accepted:
Private Sub ComboBox1_KeyPr ess(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyPressE ventArgs) Handles ComboBox1.KeyPr ess
Select Case e.KeyChar
Case "0" To "9"
Case Else
e.Handled = True
End Select
End Sub
BTW: I'm using VS2002.
Tosch
On Thu, 11 Nov 2004 09:58:23 -0500, "Bernie Yaeger"
<be*****@cherwe llinc.com> wrote: Hi Tosch,
Use the keypress event. The following worked fine for me, disallowing 'a': If e.KeyChar = "a" Then
e.Handled = True
End If
HTH,
Bernie Yaeger
"Tosch" <to**********@s wissonline.ch> wrote in message news:18******* *************** **********@4ax. com...I have a combobox where a user can select a zoom factor or enter a zoom factor. I tried to limit entry into the combobox to numbers only by catching the keydown event and setting e.handled = true if any non number characters are entered. But those characters still appear in the combobox. Is this a combobox bug? If yes any workarounds?
Tosch
Tosch,
Tosch,
Some hours ago I showed this sample too EDB he told me that it was what he
wanted, however, that it can be optimized, and he is right, it where first
two samples. http://groups.google.com/groups?selm...TNGP12.phx.gbl
I did not change them yet.
I hope however that it helps you as well.
Cor
"Tosch" <to**********@s wissonline.ch> This is my code and it's not working. I want only numbers 0-9 accepted:
Private Sub ComboBox1_KeyPr ess(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles ComboBox1.KeyPr ess Select Case e.KeyChar Case "0" To "9" Case Else e.Handled = True End Select End Sub
BTW: I'm using VS2002.
Tosch
On Thu, 11 Nov 2004 09:58:23 -0500, "Bernie Yaeger" <be*****@cherwe llinc.com> wrote:
Hi Tosch,
Use the keypress event. The following worked fine for me, disallowing 'a': If e.KeyChar = "a" Then
e.Handled = True
End If
HTH,
Bernie Yaeger
"Tosch" <to**********@s wissonline.ch> wrote in message news:18****** *************** ***********@4ax .com...I have a combobox where a user can select a zoom factor or enter a zoom factor. I tried to limit entry into the combobox to numbers only by catching the keydown event and setting e.handled = true if any non number characters are entered. But those characters still appear in the combobox. Is this a combobox bug? If yes any workarounds?
Tosch
Tosch,
Tosch,
Some hours ago I showed this sample too EDB he told me that it was what he
wanted, however, that it can be optimized, and he is right, it where first
two samples. http://groups.google.com/groups?selm...TNGP12.phx.gbl
I did not change them yet.
I hope however that it helps you as well.
Cor
"Tosch" <to**********@s wissonline.ch> This is my code and it's not working. I want only numbers 0-9 accepted:
Private Sub ComboBox1_KeyPr ess(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles ComboBox1.KeyPr ess Select Case e.KeyChar Case "0" To "9" Case Else e.Handled = True End Select End Sub
BTW: I'm using VS2002.
Tosch
On Thu, 11 Nov 2004 09:58:23 -0500, "Bernie Yaeger" <be*****@cherwe llinc.com> wrote:
Hi Tosch,
Use the keypress event. The following worked fine for me, disallowing 'a': If e.KeyChar = "a" Then
e.Handled = True
End If
HTH,
Bernie Yaeger
"Tosch" <to**********@s wissonline.ch> wrote in message news:18****** *************** ***********@4ax .com...I have a combobox where a user can select a zoom factor or enter a zoom factor. I tried to limit entry into the combobox to numbers only by catching the keydown event and setting e.handled = true if any non number characters are entered. But those characters still appear in the combobox. Is this a combobox bug? If yes any workarounds?
Tosch
"Tosch" <to**********@s wissonline.ch> schrieb: This is my code and it's not working. I want only numbers 0-9 accepted:
Private Sub ComboBox1_KeyPr ess(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles ComboBox1.KeyPr ess Select Case e.KeyChar Case "0" To "9" Case Else e.Handled = True End Select End Sub
BTW: I'm using VS2002.
IIRC that's caused by the buggy implementation of the combobox.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
"Tosch" <to**********@s wissonline.ch> schrieb: This is my code and it's not working. I want only numbers 0-9 accepted:
Private Sub ComboBox1_KeyPr ess(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles ComboBox1.KeyPr ess Select Case e.KeyChar Case "0" To "9" Case Else e.Handled = True End Select End Sub
BTW: I'm using VS2002.
IIRC that's caused by the buggy implementation of the combobox.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Hi Tosch,
I tried your code inside vs 2003, which is all that I work with, and it
worked fine. So the answer has to be that there's a bug in 2002. Also, you
have to add a few characters - backspace, delete, arrow keys, etc. So you
may want to modify your code, into something like this:
Dim KeyAscii As Integer = Asc(e.KeyChar)
Select Case KeyAscii
Case 8, 27, 48 To 57, 9
Case Else
KeyAscii = 0
End Select
If KeyAscii = 0 Then
e.Handled = True
Else
e.Handled = False
End If
HTH,
Bernie Yaeger
"Tosch" <to**********@s wissonline.ch> wrote in message
news:8r******** *************** *********@4ax.c om... This is my code and it's not working. I want only numbers 0-9 accepted:
Private Sub ComboBox1_KeyPr ess(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles ComboBox1.KeyPr ess Select Case e.KeyChar Case "0" To "9" Case Else e.Handled = True End Select End Sub
BTW: I'm using VS2002.
Tosch
On Thu, 11 Nov 2004 09:58:23 -0500, "Bernie Yaeger" <be*****@cherwe llinc.com> wrote:
Hi Tosch,
Use the keypress event. The following worked fine for me, disallowing 'a': If e.KeyChar = "a" Then
e.Handled = True
End If
HTH,
Bernie Yaeger
"Tosch" <to**********@s wissonline.ch> wrote in message news:18****** *************** ***********@4ax .com...I have a combobox where a user can select a zoom factor or enter a zoom factor. I tried to limit entry into the combobox to numbers only by catching the keydown event and setting e.handled = true if any non number characters are entered. But those characters still appear in the combobox. Is this a combobox bug? If yes any workarounds?
Tosch This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Iain Miller |
last post by:
Struggling a bit here & would be grateful for any help.
I have a table which has a list of people in it. Each person has a unique ID
automatically allocated by Access but also belongs to one of 5 Groups - call
them A to E. I'd like to generate a further automatic reference number based
on something like Group/Unique ID so when I create a new record Access
creates the Unique ID & I then enter in the group and then Access combines
the two...
|
by: Nancy |
last post by:
I have two tables:
TblCourse
CourseID
CourseName
TblClass
ClassID
CourseID
ClassDate
|
by: Trent |
last post by:
I am in the design phase of a new database and am having a devil of a
time with a subform.
I have three tables that relate to problem - Suppliers tbl, Customers
tbl and a SuppliersCustomers tbl. The intent is to have the user enter
in spend information by customer with each supplier. Sounds simple
enough right?
The common fields in each table are as follows:
|
by: Tosch |
last post by:
I have a combobox where a user can select a zoom factor or enter a
zoom factor.
I tried to limit entry into the combobox to numbers only by catching
the keydown event and setting e.handled = true if any non number
characters are entered.
But those characters still appear in the combobox. Is this a combobox
bug?
If yes any workarounds?
Tosch
|
by: Melson |
last post by:
Hi
I've a problem. Can anyone help. I would like to use datagrid for data
entry. How can I set the number of rows in the datagrid. And use the
datagrid to update the ms sql table.
regards
melson
| |
by: Caro |
last post by:
Hello,
Is it possible to create a sort of validation rule that will limit the
data entry in a field to even numbers only ?
thaks,
Caro
|
by: tizmagik |
last post by:
I have a combobox on a continuous form that has a recordsource that is
set upon Form_Load event via VBA (based on initial form data and
external form data entered). For data entry purposes the Combobox's
value is saved to *another* field (text-field) in the appropriate table
(this text-field is not visible in the Continuous Form); so the
combobox is pretty much just for data-lookup purposes (so the user does
not have to type anything).
...
|
by: nt8jbwu02 |
last post by:
I would like to allow a user to enter an ip address (quad octet format:
www.xxx.yyy.zzz) in a combo box and then add it to the list when they
have completed the entry.
How can I do this?
The textupdate and textchanged events fire for each keystroke so I
don't think that is the solution. I was hoping there was an event
which would fire when they completed text entry and hit enter or the
hit the down arrow but no such luck. I can...
|
by: injanib via AccessMonster.com |
last post by:
is it possible that if the limit to list property of a combobox is set to
true the focus is passed onto another field? What I mean is that I have a
combo box with the limit to list property set to true. the Notinlist event
procedure prompts that the entry is not in the list and if I want to add it
to the list. This is where it becomes tricky. Some times I want to add the
new data in the list if it is a new permanent employee, which then it...
|
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...
|
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...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |