Thread View: borland.public.csharpbuilder.winforms.controls.using
7 messages
7 total messages
Started by John F.
Wed, 18 May 2005 07:12
Changing text to Uppercase as it's entered into control
Author: John F.
Date: Wed, 18 May 2005 07:12
Date: Wed, 18 May 2005 07:12
14 lines
1117 bytes
1117 bytes
Hi! I'm trying to display all text in a control in uppercase as I enter it. I've tried using the 'text_changed" method of, say, a combobox, as follows: this.myComboBox.Text.ToUpper() but this doesn't cause the text to appear in uppercase. How can i do this? Thanks for all help! John F.
Re: Changing text to Uppercase as it's entered into control
Author: Marc Rohloff TeamB
Date: Thu, 19 May 2005 01:55
Date: Thu, 19 May 2005 01:55
13 lines
1559 bytes
1559 bytes
On 18 May 2005 00:12:31 -0700, John F. wrote: > I'm trying to display all text in a control in uppercase as I enter it. I've tried using the 'text_changed" method of, say, a combobox, as follows: > this.myComboBox.Text.ToUpper() > but this doesn't cause the text to appear in uppercase. > How can i do this? Handle the KeyPress event and convert the Key to uppercase. -- Marc Rohloff [TeamB] marc rohloff -at- myrealbox -dot- com
Re: Changing text to Uppercase - not quite there yet....
Author: John F
Date: Wed, 25 May 2005 07:33
Date: Wed, 25 May 2005 07:33
41 lines
2143 bytes
2143 bytes
Thanks, Marc.
I know I'm missing something incredibly obvious but I've tried a few variations without success:
private void cboxDiag1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
Char.ToUpper(e.KeyChar);
}
and
private void cboxDiag1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
char myChar = e.KeyChar;
Char.ToUpper( myChar );
e.KeyChar = myChar;
}
But no success...
Could you please steer me in the right directior?
Thanks!
John F.
"Marc Rohloff [TeamB]" <"on request"> wrote:
>On 18 May 2005 00:12:31 -0700, John F. wrote:
>
>> I'm trying to display all text in a control in uppercase as I enter it. I've tried using the 'text_changed" method of, say, a combobox, as follows:
>> this.myComboBox.Text.ToUpper()
>> but this doesn't cause the text to appear in uppercase.
>
>> How can i do this?
>
>Handle the KeyPress event and convert the Key to uppercase.
>
>--
>Marc Rohloff [TeamB]
>marc rohloff -at- myrealbox -dot- com
Re: Changing text to Uppercase - not quite there yet....
Author: Marc Rohloff TeamB
Date: Wed, 25 May 2005 20:26
Date: Wed, 25 May 2005 20:26
7 lines
1469 bytes
1469 bytes
On 25 May 2005 00:33:47 -0700, John F wrote: e.KeyChar = Char.ToUpper(e.KeyChar); -- Marc Rohloff [TeamB] marc rohloff -at- myrealbox -dot- com
Re: Changing text to Uppercase - 'ReadOnly' error....
Author: John
Date: Fri, 27 May 2005 07:19
Date: Fri, 27 May 2005 07:19
16 lines
1622 bytes
1622 bytes
Hmmm.... I tried this code and get a compiler error: 'Property or indexer System.Windows.Forms.KeyPressEventArgs.KeyChar cannot be assigned to - it is readonly. I'm using it in a ComboBox... I wonder if that makes a difference? Thanks, once again, for your help, Marc. John F. Marc Rohloff [TeamB] wrote: > On 25 May 2005 00:33:47 -0700, John F wrote: > > e.KeyChar = Char.ToUpper(e.KeyChar); >
Re: Changing text to Uppercase - 'ReadOnly' error....
Author: Marc Rohloff TeamB
Date: Fri, 27 May 2005 23:59
Date: Fri, 27 May 2005 23:59
17 lines
1880 bytes
1880 bytes
On Fri, 27 May 2005 00:19:24 -0700, John wrote: > 'Property or indexer System.Windows.Forms.KeyPressEventArgs.KeyChar > cannot be assigned to - it is readonly. Yes youre right, my bad. You should be able to handle the TextChanged event something like: ComboBox thisBox = ( ComboBox )sender; int cursorPosition = thisBox.SelectionStart; thisBox.Text = thisBox.Text.ToUpper(); thisBox.SelectionStart = cursorPosition; -- Marc Rohloff [TeamB] marc rohloff -at- myrealbox -dot- com
Re: Changing text to Uppercase - 'ReadOnly' error....
Author: John
Date: Sat, 28 May 2005 22:39
Date: Sat, 28 May 2005 22:39
21 lines
1846 bytes
1846 bytes
Thanks, again, Marc. Couldn't do it without you! John. Marc Rohloff [TeamB] wrote: > On Fri, 27 May 2005 00:19:24 -0700, John wrote: > > >>'Property or indexer System.Windows.Forms.KeyPressEventArgs.KeyChar >>cannot be assigned to - it is readonly. > > > Yes youre right, my bad. > > You should be able to handle the TextChanged event something like: > > ComboBox thisBox = ( ComboBox )sender; > int cursorPosition = thisBox.SelectionStart; > thisBox.Text = thisBox.Text.ToUpper(); > thisBox.SelectionStart = cursorPosition; >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads