This article is a mirror article of machine translation, please click here to jump to the original article.

View: 16251|Reply: 0

[Communication] When writing c# timed lock screen software, the initial value of TextBox cannot be null, otherwise it will be abnormal

[Copy link]
Posted on 1/23/2019 9:19:06 AM | | |
When debugging, the value of TextBox.text is not null, and there must be an initial value, which is mainly implemented through the two methods of TextBox: Get Focus Enter and Lose Focus: Leave.

The idea is as follows:

   1. Set a string constant as the initial value of the TextBox;

   2. In the interface construction method, assign the default value to the TextBox, and set the ForeColor of the TextBox to gray;

   3. Write the Get Focus Method TextBox_Enter (object sender, EventArgs e) to determine whether the Text of the TextBox is equal to the default value.

      Yes: Empty the TextBox content and change the foreground color ForeColor to the normal color

   4. Lose focus method TextBox_Leave (object sender, EventArgs e) to determine whether the Text of the TextBox is empty, and if it is, it will display the default value in gray again

My timed lock screen software is constantly improving.





Previous:Pixie Beautification 3.9.7 VIP Cracked Version Avatar screen name desktop timing wallpaper beautification
Next:Visual Studio 2017 configuration GitHub point tools update and extension errors
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com