In. Net CF, when textbox is input, lowercase is converted to uppercase.

Source: Internet
Author: User
If you don't pay attention to a small function, it's hard for me, huh, huh.

To implement this function in. NET Framework, it is very simple: (there are two types)
1> set charactercasing of textbox to "upper"
2> responding to the textbox keypress event,CodeAs follows:
If (char. islower (E. keychar ))
E. keychar = Char. toupper (E. keychar );

In. NET Compact framework, these two methods are not supported.
1> textbox in. Net CF does not have the charactcasing attribute (opennet cf should be available)
2> E. keychar under the textbox keypress event in. Net CF is a read-only attribute.

So, I implement the following:
In response to the keyup event of Textbox, the Code is as follows:
Private void textbox1_keyup (Object sender, keyeventargs E)
{
Textbox1.text = textbox1.text. toupper ();
Textbox1.selectionstart = textbox1.text. length;
Return;
}

I wonder if you have a better implementation?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.