Hello,
I am trying to edit a textbox which contains a number. When focus is
on the textbox, and a user press the "arrow up", I would like the
textbox value to increase of 100, and at the opposite when the user
press "arrow down", I would like this value to decrease by 100.
For the moment I have done that using the "keypress" event, but I have
a problem, as this event reacts to any key of the keyboard.
So I would need whether another idea to proceed or a way to qualify
the key which is being pressed as the "arrow up" or "down", then I
could use a conditional phrase.
Thank you for your help. ar**********@ho tmail.com 2 12794
"Arno" <ar**********@h otmail.com> wrote in message
news:40******** *************** ***@posting.goo gle.com... Hello, I am trying to edit a textbox which contains a number. When focus is on the textbox, and a user press the "arrow up", I would like the textbox value to increase of 100, and at the opposite when the user press "arrow down", I would like this value to decrease by 100. For the moment I have done that using the "keypress" event, but I have a problem, as this event reacts to any key of the keyboard. So I would need whether another idea to proceed or a way to qualify the key which is being pressed as the "arrow up" or "down", then I could use a conditional phrase. Thank you for your help. ar**********@ho tmail.com
Keypress only returns ASCII codes, you need
to use the keydown function which returns the
code of the key pressed.
Addin the following sub to a text box will display
the value returned by the key pressed and
allow you to chose what action to take
Private Sub TextBox1_KeyDow n(ByVal KeyCode As MSForms.ReturnI nteger, ByVal
Shift As Integer)
TextBox1.Text = "Key pressed was " & KeyCode
End Sub
The down Arrow returns 40, up arrow returns 38,
left arrow 27 and right arrow 39
Keith
Arno,
Try the KeyDown event. For instance
Private Sub TextBox1_KeyDow n(ByVal KeyCode As MSForms.ReturnI nteger, ByVal
Shift As Integer)
Select Case KeyCode
Case Is = vbKeyUp
If TextBox1.Value = "" Then
TextBox1.Value = 100
Else
TextBox1.Value = TextBox1.Value + 100
End If
KeyCode = 0
Case Is = vbKeyDown
If TextBox1.Value <= 101 Or TextBox1.Value = "" Then
TextBox1.Value = ""
Else
TextBox1.Value = TextBox1.Value - 100
End If
KeyCode = 0
End Select
End Sub
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Arno" <ar**********@h otmail.com> wrote in message
news:40******** *************** ***@posting.goo gle.com... Hello, I am trying to edit a textbox which contains a number. When focus is on the textbox, and a user press the "arrow up", I would like the textbox value to increase of 100, and at the opposite when the user press "arrow down", I would like this value to decrease by 100. For the moment I have done that using the "keypress" event, but I have a problem, as this event reacts to any key of the keyboard. So I would need whether another idea to proceed or a way to qualify the key which is being pressed as the "arrow up" or "down", then I could use a conditional phrase. Thank you for your help. ar**********@ho tmail.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Veeresh |
last post by:
When I enter some data in textbox1 and hit enter key resulting in calling
the clicked event of Button1. What I am doing wrong here?
-- Veeresh
Here is my code.
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm2.aspx.vb"
Inherits="Test001.WebForm2"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
|
by: Glenn M |
last post by:
I have a shared XML file on a server .
i also have one xslt file that performs a simple transform on in to
view the data.
now i want to have another page that lets users modify the shared xml
file via some editable controls such as text boxes , option boxes etc.
how can i implment this , should i use another xslt file with <INPUT>
controls . if so how can i save the result back using the asp.net
|
by: Hal Gibson |
last post by:
Because of a legacy (originally DOS) Sub
Procedure "AlphaInput" that is called in thousands of
places in our code, I need to be able to set a
variable, "KeyedString",to the value of TextBox.Text
(KeyedString originally was set by tracking each
individual key pressed, independently of textbox.text)
Since we're setting KeyedString during the keypress
event, Textbox.Text is always one character behind.
|
by: Jordi Rico |
last post by:
Hi,
I was wondering how could I do something which was really easy to do
with VB 6.0.
Let's suppose I have a textbox in which I want to capture some key
events to handle them (for example a numeric only textbox). It is easy,
with e.handled=True.
But what if what I want to do is replacing the key I'm pressing with
some other code? For example, catching all the vowels keys and
replacing with "*", so when they are writing in the textbox, a...
|
by: Darin |
last post by:
I have a form w/ a textbox and Cancel button on it. I have a routine to
handle textbox.validating, and I have the form setup so the Cancel
button is the Cancel button.
WHen the user clicks on the cancel button, the textbox.validating is
being called. I don't want it to be since they are exiting the screen
the validation doesn't have to be done.
How can I do that.
| |
by: DFS |
last post by:
This works pretty well, and it's easy, but it's not the ultimate solution.
The kludgey part is it uses a hidden field to incrementally capture the
keystrokes in the visible field (because executing code from KeyPress in the
visible field doesn't work - for some reason Access doesn't see the letters
until Exit or AfterUpdate is executed - maybe Refresh too). So you have to
make sure the data in the hidden field matches what's in the visible...
|
by: ameen.abdullah |
last post by:
Hi Guys,
I have a textbox in windows form that should only accept alphabets,
numbers, spaces and underscore. If the textbox contains anyother
character it should display a msg at the time of validation.. Is there
any funciton in vb.net for this? or any other way??
Waiting for ur replies...
|
by: rn5a |
last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB
table. Users can modify the records using this DataGrid for which I am
using EditCommandColumn in the DataGrid. This is the code:
<script runat="server">
Dim sqlConn As New SqlConnection(".....")
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
If Not (Page.IsPostBack) Then
FillDataGrid()
|
by: Ina |
last post by:
Hello guys,
I have a problem with the keypress event:
I would like to avoid an event --goto next textbox using a
vbkeyreturn: but did not work any suggestion how to do that if it is
feasible.
thanks
|
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: 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,...
| |
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: 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();...
| |
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
| |