将文字转换为大写,而在文本框中输入

问题描述:

我是新的Visual Studio和使用Visual Studio 2008。
在一个项目,我想在大写的所有文字,而由用户输入,而不pressing Shift键或大写锁定。
我已经使用这个code

I am new in Visual Studio and using visual Studio 2008. In a project I want to make all text in uppercase while typed by the user without pressing shift key or caps lock on. I have used this code

TextBox1.Text = TextBox1.Text.ToUpper();

但它利用后pressing字符Enter键。

but it capitalize characters after pressing Enter key.

我只想说字符出现在大写,而没有pressing Shift键或无上限输入用户锁定。

I just want that characters appear in uppercase while typing by the user without pressing shift key or without caps lock on.

总计页面code是为...

Total page code is as...

公共部分类测试:System.Web.UI.Page
 {

public partial class Test : System.Web.UI.Page {

protected void Page_Load(object sender, EventArgs e)
{

}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
    TextBox1.Text = TextBox1.Text.ToUpper();

}

}

有任何一个的任何解决方案,请指导我。

Have any one any solution, please guide me.

有对这个特定属性。它被称为CharacterCasing你可以将其设置为上限

There is a specific property for this. It is called CharacterCasing and you could set it to Upper

  TextBox1.CharacterCasing = CharacterCasing.Upper;

在ASP.NET你可以尝试添加到您的文本风格

In ASP.NET you could try to add this to your textbox style

  style="text-transform:uppercase;"

您可以在这里找到一个例子:http://www.w3schools.com/cssref/pr_text_text-transform.asp

You could find an example here: http://www.w3schools.com/cssref/pr_text_text-transform.asp