开发者

Prevent some DataColumns in a DataTable from being bound to DataGridView

开发者 https://www.devze.com 2023-01-01 03:47 出处:网络
Is there any way I can specify that some columns in a DataTable wil开发者_JAVA技巧l not be automatically bound to a DataGridView when I set the DataSource property of the DataGridView to the DataTable

Is there any way I can specify that some columns in a DataTable wil开发者_JAVA技巧l not be automatically bound to a DataGridView when I set the DataSource property of the DataGridView to the DataTable.

For example, if I have a DataTable with columns as "Id, Name" then can I specify that Id column will not be shown in DataGridView? I know I can set some Visible property in DataGridView after it is bound, but can I specify in the DataTable/DataColumn itself?


It's best to setup the columns and their bindings.

How to: Add and Remove Columns in the Windows Forms DataGridView Control Using the Designer

Otherwise, you can remove the unwanted columns:

How to: Hide Columns in the Windows Forms DataGridView Control Using the Designer

0

精彩评论

暂无评论...
验证码 换一张
取 消