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 message
like "I like cats" would show like "* l*k* c*ts". I don't have access
to replace the incoming key, so no idea of doing this...
Thanks! 3 2668
Well, you can say that e.handled = True and then manually append the * to
the string in the text box yourself.
"Jordi Rico" <jo*******@gmai l.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. . 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 message like "I like cats" would show like "* l*k* c*ts". I don't have access to replace the incoming key, so no idea of doing this... Thanks!
"Robin Tucker" <un********@due tospam.com> schrieb: Well, you can say that e.handled = True and then manually append the * to the string in the text box yourself.
\\\
Private Sub TextBox1_KeyPre ss( _
ByVal sender As Object, _
ByVal e As KeyPressEventAr gs _
) Handles TextBox1.KeyPre ss
Select Case e.KeyChar
Case "a"c, "e"c, "i"c, "o"c, "u"c
e.Handled = True
Me.TextBox1.Sel ectedText = "*"
End Select
End Sub
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Hi,
Not sure what you mean by 'I don't have access to replace incoming key'.
This might work for you:-
Private Sub TextBox1_KeyPre ss(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyPressE ventArgs) Handles TextBox1.KeyPre ss
If e.KeyChar = "e" Then 'Add additional Boolean logic for other
vowels
TextBox1.Text = TextBox1.Text & "*"
TextBox1.Select ionStart = TextBox1.Text.L ength
e.Handled = True
End If
End Sub
"Jordi Rico" <jo*******@gmai l.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com.. . 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 message like "I like cats" would show like "* l*k* c*ts". I don't have access to replace the incoming key, so no idea of doing this... Thanks! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Arno |
last post by:
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...
|
by: David Smith |
last post by:
What I want to be able to do:
A textbox is available that the user can enter information into.
Specifically (for the purposes of this post), the user is asked to
enter a number, and that number has an upper limit. I want to do
validation on what the user enters as they type it in.
I set up an event handler for KeyPress that restricts them from being
able to enter non-numeric characters (only allowing numbers, decimal
point, control...
|
by: Steph. |
last post by:
Hi,
I have made a new custom TextBox control to enable ENTER and TAB keys to be trapped in the "KeyPress" and "KeyDown" Events. to do that I have overridden the "IsInputKey" property in my new control (derived from the TextBox control)(see code below).
I can now manage the KeyPress/Down event raised by TAB and ENTER keys, but I have one problem : A sound (ding) is played by my computer every time I press the TAB or ENTER key in...
|
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: Fool |
last post by:
Hi,
I want a rich textbox that dynamically highlights particular words
immediately after they are typed. Just looking for some general
tips...
I tried putting some code in a sub that handles the textchanged event
for that textbox. The issue here is that the focus jumps to the words
to be highlighted (naturally, I suppose, since my technique is to
search for specific words, select them, and highlight them). But I
| |
by: scottiedog |
last post by:
Hi
How can I send a char to Textbox so that KeyPress event is called? I have a button and with a click I would like to send a char, e.g. "C", to the Textbox. But Textbox1_KeyPress is not catching the event (I can step thru KeyPress ok but nothing goes to TextBox). KeyPress itself works fine with key stroke via keyboard
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Clic
Dim e2 As New...
|
by: Woody Splawn |
last post by:
I would like to be able to know if the user has pressed a key in any text
box on a winform or in other words, if he is editing a record. I would like
to know this as soon as he presses any key. I know that I can check for
keypress on a given field, but I don't want to do this for every field on
the form. Is there a way to determine what I want to know?
|
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: windy |
last post by:
I got a question about keypress event on textbox:
I found that the keypress event doesn't invoked when i press the "."
button on alphabetic keyboard, however if i use numberpad's "." button
keypress event is invoked.
Any idea and solutions?
Thanks.
|
by: Jason Huang |
last post by:
Hi,
How do I override a TextBox's KeyPress evnt? And how do we use it?
Thanks for help.
Jason
|
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: 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: 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: 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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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: 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...
| |