Jaume
Jaume

Reputation: 3780

VB .Net Disable user row resize on datagridview

I am filling Datagridview with dataset and Datagridview has all resize properties set to false but, user can even resize rows. How could I disable it?

MyDatagridView.AllowUserToAddRows = False
MyDatagridView.AllowUserToResizeRows = False
MyDatagridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None
...

Upvotes: 0

Views: 3223

Answers (2)

Sylvia
Sylvia

Reputation: 34

I realize that this is an old post, but I had exactly the same problem. The AllowUserToResizeRows property may be overridden by the MyDatagridView.RowTemplate.Resizable setting. Try setting both to False, solved the problem for me.

Upvotes: 1

Oak_3260548
Oak_3260548

Reputation: 2000

In my experience,

MyDatagridView.AllowUserToResizeRows = False

does always prevents user to resize a row. I don't remember a case when it would be overriden by another property setting (and I use DataGridViews a lot). So I would say the line is not processed (you can debug it) or it is overriden by another setting later (track property value and see when it gets changed).

And by thew way, you can set it in the Datagridview Properties in VisualStudio, to make it a default setting.

Upvotes: 0

Related Questions