Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个任务,我的文本框只接受第一个字符大写字母和剩余字符正常。
使用文本框的 KeyPress 事件:
私人无效txt_KeyPress(对象发送者,KeyPressEventArgs e) { if (txt.Text != "" && !Char.IsUpper(txt.Text, 0)) { txt.Text = Char.ToUpper(txt.Text[0]) + txt.Text.Substring(1); } }