C # WinForm Programming summary

Source: Internet
Author: User

1. Empty DataGridView

1 /// <summary>2         ///Empty DataGridView3         /// </summary>4         /// <param name= "DG" >DataGridView</param>5          Public voidCleardatagridview (DataGridView DG)6         {7             Try8             {9                 if(DG = =NULL|| Dg. DataSource = =NULL)Ten                 { One                     return; A                 } -  -DataTable dt =(DataTable) DG. DataSource; the  - dt. Rows.clear (); -  -Dg. DataSource =DT; +  -             } +             Catch(Exception e) A             { at                 stringErrorMsg =string. Format (@"Error occurred while clearing {0} datagridview data due to: {1}", DG. Name, e.message); -  - Platform.Log (Loglevel.fatal, errormsg); -  - Alifmessageboxshowerror (errormsg); -             } in}

2. Empty C1flexgrid

1 /// <summary>2         ///Empty C1flexgrid3         /// </summary>4         /// <param name= "C1FG" >C1flexgrid</param>5          Public voidClearc1flexgrid (C1. Win.C1FlexGrid.C1FlexGrid C1FG)6         {7             Try8             {9                 if(C1FG! =NULL)Ten                 { One C1fg.clear (C1. Win.C1FlexGrid.ClearFlags.Content); A                 } -             } -             Catch(Exception e) the             { -                 stringErrorMsg =string. Format (@"empty {0} C1. Error Win.C1FlexGrid.C1FlexGrid data, cause: {1}", C1fg.name, e.message); -  - Platform.Log (Loglevel.fatal, errormsg); +  - Alifmessageboxshowerror (errormsg); +             } A}

C # WinForm Programming summary

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.