WinForm DataGridView does not show default first column does not show unbound column data source changes automatically when changed (GO)

Source: Internet
Author: User

The first column with an asterisk is not displayed:

Set Rowheadersvisiber to False in the DataGridView property box

Do not show unbound columns:

DataGridView has a property of AutoGenerateColumns. But what's not understandable is that this property is not in the property box, so you can't find it there. Can only be set in the background code.

This.datagridview1.AutoGenerateColumns = false;

Automatically update when the data source changes:

The DataGridView data source is often changed during page operations. We certainly want the display of DataGridView to be consistent with its data source, but when the data source changes, we have to re-assign it in common sense.

This.datagridview1.datasource = changed data source object; But it's not going to change the display, and even if we add a word to it later,

This.datagridview1.refresh (); it's still not going to change. To achieve the purpose, the following methods can be used:

This.datagridview1.datasource = null;

This.datagridview1.datasource = changed data source object;

WinForm DataGridView does not show default first column does not show unbound column data source changes automatically when changed (GO)

Related Article

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.