Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
| Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 8th, 2003, 09:42 AM
Authorized User
 
Join Date: Jun 2003
Location: Rio de Janeiro, Rio de Janeiro, Brazil.
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default Capital Letters in a COMBOBOX. How can i do it?

How I can place in capital letters the text of a COMBOBOX?
For TEXTBOX I use:
textBox1.CharacterCasing = CharacterCasing.Upper;...
How to make the same for a COMBOBOX?
There isnt a CharacterCasing metod for a COMBOBOX...
  #2 (permalink)  
Old September 8th, 2003, 10:26 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Thomaz,

If it's not supported, you should do it by hand. When you add items to the drop-down, change the text to upper case right before you add the item. To allow users to add their own items, write some code for when the drop-down looses focus (in the LostFocus event) and change the case for the item that has been inserted.

There may be other ways as well, but this is what I would try first.

Cheers,

Imar




---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #3 (permalink)  
Old October 17th, 2003, 11:47 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thomaz,

Here is how I did it. In the TextChanged event of the ComboBox add the following code:

ComboBox thisBox = ( ComboBox )sender;
int cursorPosition = thisBox.SelectionStart;
thisBox.Text = thisBox.Text.ToUpper();
thisBox.SelectionStart = cursorPosition;

I hope this helps.

-Jim



Similar Threads
Thread Thread Starter Forum Replies Last Post
Latin letters itHighway Classic ASP Professional 3 July 20th, 2006 12:14 AM
"C++ lottery" with letters and words dovids C++ Programming 8 July 19th, 2005 03:11 AM
Help with letters ittorget Classic ASP Basics 3 October 14th, 2003 01:11 PM
Capital Letters no Vowels. endamist BOOK: Beginning Java 2 1 August 12th, 2003 05:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.