?
Solved

C# WinForms - Scroll in a DataGrid

Posted on 2007-07-27
5
Medium Priority
?
2,355 Views
Last Modified: 2010-02-13
Hi,

I'm displaying a lots of columns in a WinForms DataGrid control.

My columns are so many that they're all squashed up against each other.

The problem is that I can't seem to find some kind of property like a scrollbar or something. Isn't there a property on the DataGrid that enables a scrollbar?

Thank you.
0
Comment
Question by:Endelm
  • 3
5 Comments
 

Author Comment

by:Endelm
ID: 19581440
My DataGrid control is:
System.Windows.Forms.DataGridView
0
 

Author Comment

by:Endelm
ID: 19581483
I'm talking about horizontal scrolling of the DataGridView control.
0
 
LVL 20

Accepted Solution

by:
REA_ANDREW earned 2000 total points
ID: 19581513
what I would do is place your DataGridView inside a panel.  Then Add a HScrollBar to the panel.  You would have to add the programming to the ScrollBar but that would be perfect for your needs.  

Even further than that you can simply manipulate the left value of your DataGridView inside your panel.  Test this by giving your DataGridView inside your panel a Left of says -50 .

Add your own buttons for GUI, or add a scroll bar.  You have many options to achieve this

:-)

Andrew
0
 

Author Comment

by:Endelm
ID: 19581572
Thank you REA_ANDREW.

What property is the scroll bar changing?

Thank you.
0
 
LVL 7

Expert Comment

by:illusio
ID: 19581785
dataGridView1.ScrollBars = ScrollBars.Both;

Also handy:
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
AllCells is slow but other values are also possible.

Kind regards,
Peter
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Six Sigma Control Plans

807 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