C#.net methods for binding data to DataGridView columns and displaying column names

Source: Internet
Author: User
Select the DataGridView control, select the Colums property item in the property click, edit the column of the DataGridView control, you can add more than one column item through the column editor, where the Headtext of the column properties is displayed externally, which is presented to the user, Name is used to name the Column object, and DataPropertyName is used to specify that you bind the column of the data source to that column, that is, the column property can bind the specified data to the column in DataGridView. For example, to specify the DataPropertyName column property as a column name for the data source, such as "UserName" in the data source, specify the DataPropertyName column property as "UserName" and the data source " The UserName column corresponds to the column specified in DataGridView, and also to the data column specified for the column bindings in DataGridView. The display name of the column has the column property headtext specified.

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.