Solved

VS C# Vertical Scroll Bar

Posted on 2013-11-11
5
624 Views
Last Modified: 2013-11-12
I have a VS C# 2008 application with a form that contains a data grid view. Is there anyway to force the vertical scroll bar to always appear on the datagridview? The window is large enough for 20 records. If there are more than 20 records to display the vertical scroll bar appears but if there are less the scroll bar does not appear leaving an empty gray area where the scroll bar would be.
0
Comment
Question by:rwheeler23
  • 3
  • 2
5 Comments
 
LVL 29

Expert Comment

by:anarki_jimbel
ID: 39640570
No, you cannot force scrollbars to show. However you may try to adjust column width to hide "grey area".

Some authors suggest using an external scroll bars but I'm not sure it worth efforts.

one more thing is to add "blank" lines to a data grid view but it is possible in some scenarios only...
0
 

Author Comment

by:rwheeler23
ID: 39640611
I would love to add blank lines so the grid is always full. I just have not been able to find any examples of how to do that. By having blank lines the scroll bar would always appear. If you could point me to some examples that would be great!
0
 
LVL 29

Accepted Solution

by:
anarki_jimbel earned 500 total points
ID: 39640642
0
 

Author Comment

by:rwheeler23
ID: 39643264
OK, please excude my ignorance but I am not getting this. I have attached my code. The maximum number of rows to display is 20. How do I adjust this code to only append whatever number of lines are necessary to fill the grid with 20 lines. For example, if the query return 5 rows, I need 15 blank rows. If the query returns 15 rows I need 5 blank rows. If the query returns more than 20 rows I need no blank rows.
DataGridRowFill.txt
0
 

Author Closing Comment

by:rwheeler23
ID: 39643532
You got me pointed in the correct direction. Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question