輸入自動轉大小寫有2個方法
1.手動去更改code,使用事件TextChanged 輸入如下程式碼:
private void textBox1_TextChanged(object sender,System.EventArgs e) { this.textBox1.Text=this.textBox1.Text.ToUpper(); //轉大寫 /* this.textBox1.Text=this.textBox1.Text.ToLower(); //轉小寫 */ this.textBox1.SelectionStart=this.textBox1.Text.Length; }
2.使用屬性
可以把TextBox的CharacterCasing属性改為Upper即可實現自動轉大寫。
Lower改小寫,Normal是預設直。
沒有留言:
張貼留言