Solved

How get column Headers to automatically move down as user scrolls down datagrid

Posted on 2006-06-21
5
221 Views
Last Modified: 2010-05-18
Using Windows Forms, .NET 1.1, VS 2003

I have a custom datagrid control inherited from a datagrid. I am using a dataTable to populate the datagrid. I have used the first row of my dataTable for the column headers and made the columnheaders of the datagrid invisible by setting:
grid.ColumnHeadersVisible = False

But, as the user scrolls down they won't see the headers. How can I write code to make the headers move down as the user scrolls down?

Thanks

San

0
Comment
Question by:Sanmarie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 16956166
What are you trying to accomplish by writing the column headers in the first row of the DataGrid?

Bob
0
 

Author Comment

by:Sanmarie
ID: 16956794

I couldn't get the text to wrap by using the datagrid's column headers so I just decided to put them in the first row. what I have is a cross-tab with the first row being the column headers, the first column being the row headers and the data in the middle being the intersecting row-column values. when the user clicks on a value, it gives the corresponding row value in column 0 and the corresponding column value in row 0.

Sanna
0
 
LVL 19

Accepted Solution

by:
Melih SARICA earned 300 total points
ID: 16957679
Use DatabindingComplete event to hadle data binding.
then change caption of the columns with the first row values
and then
delete row 1 from grid.

0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 200 total points
ID: 16960753
Here is a custom DataGrid class that allows multi-line headers:

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21809839.html

Bob
0
 

Author Comment

by:Sanmarie
ID: 16972247
Sorry for taking long to respond.

Bob, I had found your link some time ago but it didn't work for me. I was getting an error. I think one other person on the code project was getting a similar error. It was taking too long to figure out so I decided to scrap it. So far my grid is working perfectly.

Would I need the column headers in order to get them to move down as the user scrolls down? Or, could it still work with the headers in the first row of the dataTable?

Non_Zero, could you elaborate a little bit more. I'm not clear on your suggestion.

Thank you both.

Sanna
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

739 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