473,799 Members | 3,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Uppercase in Combobox text

Hi,

How can I make the combo box text uppercase? For instance when the user
types in letters in the combobox, I want them to appear as upper case.

Thanks.

Lakshmi
Sep 19 '06 #1
5 21000
Lakshmi wrote:
Hi,

How can I make the combo box text uppercase? For instance when the user
types in letters in the combobox, I want them to appear as upper case.

Thanks.

Lakshmi

You could trap them manually in the textchanged event (bearing in mind
that the text might have changed because an item was selected).

JB
Sep 19 '06 #2
Use the following code in the keypress event of the combo box to convert the
letters to upper case:

string str = e.KeyChar.ToStr ing().ToUpper() ;
char[] ch = str.ToCharArray ();
e.KeyChar = ch[0];

--
Nand Kishore Gupta, Bangalore
"Lakshmi" wrote:
Hi,

How can I make the combo box text uppercase? For instance when the user
types in letters in the combobox, I want them to appear as upper case.

Thanks.

Lakshmi
Sep 19 '06 #3
Laskhmi,

This you can do in the same way as the thousands of numeric textboxes and
autocompletebox es samples are done on internet.

Be aware not to use the keypress but the keyup event. The later gives
information about the key that has been pressed.

For the rest it is just MyPressedcharst ring.ToUpper

I hope this helps,

Cor

"Lakshmi" <la************ ***@ayrdata.com .auschreef in bericht
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
Hi,

How can I make the combo box text uppercase? For instance when the user
types in letters in the combobox, I want them to appear as upper case.

Thanks.

Lakshmi

Sep 19 '06 #4
Do you want the items in the list to also be uppercase? If so, a simple
override will do the trick:

class UppercaseComboB ox : ComboBox
{
private const int CBS_UPPERCASE = 0x2000;
protected override CreateParams CreateParams
{
get
{
CreateParams p = base.CreatePara ms;
p.Style |= CBS_UPPERCASE;
return p;
}
}
}

/claes

"Lakshmi" <la************ ***@ayrdata.com .auwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
Hi,

How can I make the combo box text uppercase? For instance when the user
types in letters in the combobox, I want them to appear as upper case.

Thanks.

Lakshmi

Sep 19 '06 #5
QuangNhat
4 New Member
private void cboOperationCod e_KeyPress(obje ct sender, KeyPressEventAr gs e)
{
if (e.KeyChar >= 'a' && e.KeyChar <= 'z')
e.KeyChar = Convert.ToChar( e.KeyChar.ToStr ing().ToUpper() );
}
Apr 30 '12 #6

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

Similar topics

13
2799
by: Mr. B | last post by:
Here's the situation... You've a combobox with Items already added. Say they look like this (or even lines of text): 10-00-232 10-00-256 10-01-006 10-01-213 10-02-200
3
3032
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can download a fully working C# sample with the Northwind.mdb here: www.insightgis.com.au/web/stuff/DataGridCombo.zip
3
6836
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article: http://msdn.microsoft.com/msdnmag/issues/03/08/DataGrids/default.aspx I have a problem when there are two DataGrid's on one form, and when I switch focus from one grid to the other. To be more precise, when I'm editing a combo box column in one grid, and then click in the combo column of...
1
1962
by: Beffmans | last post by:
How can I turn the Uppercase mode on in my TextBoxes? ch B. *** Sent via Developersdex http://www.developersdex.com ***
5
1843
by: Brian | last post by:
I've setup a custom combobox control that allows a multikey selections. This lets the user enter key presses and the combo scrolls to the matching selection. I run into a bug when the user opens the dropdown and enters a new character which the box auto scrolls to. The combobox displays the selected value but when I reference the text and selected value properties they still have the old values. Has anyone seen a problem like this...
6
2883
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox and the coresponding 'Id' from the lookup table is to be inserted into the field of the new record. I have two simple tables. "tblPerson" is the data table. The lookup
0
2019
by: Frnak McKenney | last post by:
Can I use a bound ComboBox for both browsing and editing? I'm working on a small, standalone database application using Visual C#.NET 2003 and an Access data file. In order to keep the number of different screens down to a minimum, I'm trying to use the same Windows Forms for both browsing and for updating. This works fine for TextBoxes, but I'm running into problems with my DropDownLists (ComboBoxes).
3
3675
by: =?Utf-8?B?Sm9zZXBo?= | last post by:
Hi all, I'd like to know how to force uppercase characters in an ASP.Net web form text field. Thanks
4
12594
by: Hrsoft | last post by:
I'm a newbie with asp.net I need to transform a user textbox to uppercase, when typing. Is this possible? I read about Ajax Maskedit, but it is only to certain formats, like dates, etc Thanks in advance. Hércules Russano HRsoft Informática Rio de Janeiro - Brasil
0
9541
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,...
0
10485
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, 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...
0
10252
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 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...
0
10027
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 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...
1
7565
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 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...
0
6805
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();...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
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...

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.