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.
This topic is 3 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
ClipperXTP
Posts: 55
Last visit: Thu Jun 24, 2021 3:05 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: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

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: 55
Last visit: Thu Jun 24, 2021 3:05 am

Re: DataGridView - Vertical Scroll Always Visible?

Post by ClipperXTP »

OK thanks for the info
This topic is 3 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked