DataGridView - Vertical Scroll Always Visible?

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Post Reply
ClipperXTP
Posts: 20
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Tue Apr 28, 2020 4:07 am

DataGridView - Vertical Scroll Always Visible?

Post by ClipperXTP »

Hi
Can you let me know how to always display vertical scrollbar in a datagridview?
My datagridview is being updated by a script which returns an array.
My gui has a border on the datagridview so there is not just dead space there before it gets populated.
If my results arrray has more that 5 lines, I have a scrollbar and it fills the border nicely, all is well.
Any less than 5 rows and it leaves empty space where the vertical scrollbar normally lives.
The 'fill' control in the designer doesnt help me as it is just splitting my 3 column datagridview into equal sized columns and my data gets truncated.

I have found this in a C# forum but I can't see a corresponding option in designer or get the intellisense to give me a similar option in the script editor? : -
Try setting ScrollViewer.VerticalScrollBarVisibility="True" That property is set to Auto by default.
thanks in advance

jvierra
Posts: 14368
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: DataGridView - Vertical Scroll Always Visible?

Post by jvierra »

Sorry but there is no way to do what you ask with the WinForms DataGridView control. The property you reference does not exist on this control or in WinForms. It is only available in WPF forms.

ClipperXTP
Posts: 20
Joined: Tue Apr 28, 2020 4:07 am

Re: DataGridView - Vertical Scroll Always Visible?

Post by ClipperXTP »

OK thanks for the info

Post Reply