C # Operation Skills

Source: Internet
Author: User

A lot of details have not been recorded for a long time. Now we need to pay attention to the fact that good memory is not as good as bad writing, you know

1. In winform, how does C # determine whether the checkbox column in The dview is selected?

For (INT I = 0; I <datagridview1.rows. Count; I ++)
{
If (bool) datagridview1.rows [I]. cells [0]. editedformattedvalue = true)
{
// Todo
}
}

2. Select All checkbox columns in the datagridview

Private void checkall_checkedchanged (Object sender, eventargs e) {If (datagridview1.rows. count> 0) {for (INT I = 0; I <= datagridview1.rows. count-1; I ++) {maid (I ). cells (0 ). value = true ;}} 3. In the checkbox column of the dview datagri, select private void checkreverse_checkedchanged (Object sender, eventargs e) {If (datagridview1.rows. count> 0) {for (INT I = 0; I <= datagridview1.rows. count-1; I ++) {If (convert. toboolean (maid (I ). cells (0 ). editedformattedvalue) {maid (I ). cells (0 ). value = false;} else {datagridview1.rows (I ). cells (0 ). value = true ;}}4, C # retain the second decimal point double dbdata = 0.55555;
String str1 = dbdata. tostring ("F2"); // FN retains n digits, rounding string str1 = string. format ("{0: N2}", 5.6789); // result: 56,789.05, C # display angle symbol string str1 = string. format ("{0: N2}", 5.6789); // result: 56,789.0
Textbox1.text = str1 + "°"; special characters -- open sogou -- menu -- soft keyboard -- select "°" for special characters.

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.