473,395 Members | 1,972 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,395 software developers and data experts.

Textbox with extra properties

Hello,

I would like to create a textbox with extra properties where I can choose if
the textbox may contain only numbers, only letters, both, punctuation marks
etc.
Can anyone help me with tips how I can realise this?

Many thanks,

Michel

May 9 '07 #1
3 1500
On May 9, 12:22 pm, "Michel Vanderbeke" <michel.vanderb...@skynet.be>
wrote:
Hello,

I would like to create a textbox with extra properties where I can choose if
the textbox may contain only numbers, only letters, both, punctuation marks
etc.
Can anyone help me with tips how I can realise this?

Many thanks,

Michel
1. Create a custom control inheriting from TextBox

2. Add a property to control what type of characters are allowed.

3. Override OnKeyPress and/or OnKeyDown and stop invalid characters
there.

4. Prevent the user from Pasting in invalid characters (can't remember
if the above overrides will handle pasted characters)

5. Do anything I forgot to mention :-)

Will that get you started?

Thanks,

Seth Rowe

May 9 '07 #2
see
http://www.emoreau.com/Entries/Artic...m-Control.aspx

--
HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc. (http://www.emoreau.com)

"Michel Vanderbeke" <mi***************@skynet.bewrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
Hello,

I would like to create a textbox with extra properties where I can choose
if
the textbox may contain only numbers, only letters, both, punctuation
marks
etc.
Can anyone help me with tips how I can realise this?

Many thanks,

Michel

May 10 '07 #3
On 10 mayo, 06:03, "Eric Moreau" <eric.moreau_NO_SP...@videotron.ca>
wrote:
seehttp://www.emoreau.com/Entries/Articles/2003/03/Creating-your-own-Win....

--

HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc. (http://www.emoreau.com)

"Michel Vanderbeke" <michel.vanderb...@skynet.bewrote in message

news:O9**************@TK2MSFTNGP04.phx.gbl...
Hello,
I would like to create a textbox with extra properties where I can choose
if
the textbox may contain only numbers, only letters, both, punctuation
marks
etc.
Can anyone help me with tips how I can realise this?
Many thanks,
Michel- Ocultar texto de la cita -

- Mostrar texto de la cita -
Also, you can use a MaskEdit Control (VB6 and you can use it in
VB .net too). Once on it, you define what kind of characters you want
to admit. Check it out.

Cheers

May 11 '07 #4

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

Similar topics

6
by: Karen | last post by:
I'm having trouble getting input from a textbox in Visual Basic 6.0 Private Sub cmdGetNumber_Click() txtInput.Text = Str(Int(1000 * Rnd)) End Sub The error message states: "Method or data...
2
by: Nick | last post by:
In VS 2003 and VS 2005 beta 2 I am trying to write a simple program. It has a datagrid and a textbox along with a menubar. There is a command in the menu bar which is "Run Query" and has the...
0
by: Jonas L | last post by:
Hi, I need to create a textbox which acts as a normal textbox but with the following extra requirements: 1) In-focus color, when the textbox gets focus the backcolor property of the textbox...
2
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow...
5
by: JollyK | last post by:
Hello all, I have always been having this issue and wondering what the solution is. When I set the enableviewstate property to false for a textbox, the textbox always retains its value after a...
1
by: Dave Wurtz | last post by:
All, I have a custom control that has a textbox on it. I want to be able to set properties of the textbox in the IDE. I have exposed the textbox with a property and it now shows up in my...
7
by: spamsickle | last post by:
My database stores City and State in two separate columns, but I want to display them on my form as a single field. Since I'm a complete VB novice, I'm not sure how to do this. I bind the data,...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
4
by: weg22 | last post by:
Hi all, I'm developing a Visual Basic 2005 application to communicate with an I2C device. I recently decided to add an i2c status bar. The status bar is just a textbox with the following...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
agi2029
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,...

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.