Wednesday, January 6, 2021

[VB.net][Resolved] property value is not valid

I want last column of dataGridView automatically resize according width of application.

White I set the autoSize property to Fill on last column, it pop up an error message:

Error message: Property value is not valid

check details

Column's AutoSize mode cannot be set to Fill when it is also a frozen column


Steps:

I fix this problem in design mode but not using code.

1) Select dataGridView in designmode, and click the right-arrow icon to open "DataGridView Task" menu.

2) Select "edit Columns..." item in menu and it would popup "Edit Column" window.

3) There should be some column items under "selected Columns" text (if you don't have, add some columns)

4) In edit column panel, set "frozen" property value to False in "layout" catalog. apply on all your columns in dataGridView.

5) For last column, set "AutoSizeMode" property value to "Fill" in "layout" catalog., others columns all set to "AllCells"

6) Click "OK"


Remark: If you want dataGridView able to autoresuze according you window form application size, Set Anchor in your property panel to "Top, Bootom, Left, Right"


Reference:

https://stackoverflow.com/questions/1025670/how-do-you-automatically-resize-columns-in-a-datagridview-control-and-allow-the

No comments :

Post a Comment