473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Hiding a ColumnHeader...

Hello,
I have a number of ColumnHeaders that are 'hidden' (width
set to zero). However, it is still possible to size
them. The reason why they are hidden is to give the
illusion that they do not exist. Is there a way to stop
the user from being able to resize column headers that I
have set their width to zero?

Many thanks,

Alan
Nov 15 '05 #1
4 5574
The only way to make the cols disappear completely is to make the
underlying data columns invisible. If I'm not mistaken, there's a
"visible" property on a DAtaCOlumn object.
Set this to false and your problem is solved.

---
Regards,

Roy Osherove
www.iserializable.com

On Fri, 7 Nov 2003 08:48:36 -0800, "Alan Seunarayan"
<so****@ntlw0rld.c0m> wrote:
Hello,
I have a number of ColumnHeaders that are 'hidden' (width
set to zero). However, it is still possible to size
them. The reason why they are hidden is to give the
illusion that they do not exist. Is there a way to stop
the user from being able to resize column headers that I
have set their width to zero?

Many thanks,

Alan


Nov 15 '05 #2
Sorry,
I am actually using a ListView control.

Alan
-----Original Message-----
The only way to make the cols disappear completely is to make theunderlying data columns invisible. If I'm not mistaken, there's a"visible" property on a DAtaCOlumn object.
Set this to false and your problem is solved.

---
Regards,

Roy Osherove
www.iserializable.com

On Fri, 7 Nov 2003 08:48:36 -0800, "Alan Seunarayan"
<so****@ntlw0rld.c0m> wrote:
Hello,
I have a number of ColumnHeaders that are 'hidden' (widthset to zero). However, it is still possible to size
them. The reason why they are hidden is to give the
illusion that they do not exist. Is there a way to stop
the user from being able to resize column headers that I
have set their width to zero?

Many thanks,

Alan


.

Nov 15 '05 #3
On Sun, 9 Nov 2003 13:55:36 -0800, <so****@ntlworld.com> wrote:
Sorry,
I am actually using a ListView control.

Alan
[2 quoted lines suppressed]

make the
[1 quoted line suppressed]

there's a
[14 quoted lines suppressed]

(width
[12 quoted lines suppressed]


Hmm. IN that case I don't think there's a way
--
Roy Osherove
weblog: http://www.iserializable.com
Nov 15 '05 #4
Well there is a way and it is quite simple.

The columns are stored in the ListView.Columns collection, so you can remove
and add columns as you like.
Only those in the collection will be shown.

E.g.
System.Windows.Forms.ColumnHeader headerToShowHide = new
System.Windows.Forms.ColumnHeader();

private void ToggleColumn()
{
if (this.myListView.Columns.Contains(headerToShowHide ))
{
this.myListView.Columns.Remove(headerToShowHide);
headerToShowHide.Text = "Now I am hidden";
}
else
{
headerToShowHide.Text = "See me now?";
this.myListView.Columns.Insert(1, headerToShowHide);
}
}

Just remove it when you want to hide it.
Insert it at the desired position and you see it again.

Eric-Paul Jansen
Inforay International B.V. (http://www.inforay.com)
The Netherlands

"Roy Osherove" <ro**@iserializable.com> wrote in message
news:1d******************************@40tude.net.. .
On Sun, 9 Nov 2003 13:55:36 -0800, <so****@ntlworld.com> wrote:
Sorry,
I am actually using a ListView control.

Alan
[2 quoted lines suppressed]

make the
[1 quoted line suppressed]

there's a
[14 quoted lines suppressed]

(width
[12 quoted lines suppressed]


Hmm. IN that case I don't think there's a way
--
Roy Osherove
weblog: http://www.iserializable.com

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: singh | last post by:
using "Details" as a view mode in listview, but can't find an option to hide columnheader. does anyone know how to do it. thanks
1
by: joannelai | last post by:
Hi all, In my project I have a ListView and a ColumnClick event is added to sort the clicked column. I want to have a Context Menu when the ColumnHeader is right clicked, but I find no way to...
0
by: Mason | last post by:
Is there any way to add an image to a datagrid columnheader? Any advice will be helpful!
0
by: Meelis Lilbok | last post by:
Hi Is it possible to set listview's columnheader background image? No luck with drawcolumnheader :( Best regards; Meelis
1
by: Fabian_20 | last post by:
Hello everybody, sry for the bad title :). I created an extended ListView with an extended ColumnHeader. If i add a new ColumnHeader through the designer, it appears on the left side of the...
0
by: Fred | last post by:
Is there a way to know the height of the ColumnHeader in a ListView (with Detail View). I measured that on Windows 2000, it seems to be 18 pixels height, but this isn't reliable and may vary...
0
by: windy | last post by:
Hi all, how can i add tooltip for columnheader on datagridview? Thanks.
1
by: szuccaro | last post by:
I am reading an excel file into a datagridview and trying to perform some function based on the column header that is clicked. I currently can produce an event to occur (msgbox) but, I need to get...
3
by: =?Utf-8?B?WVhR?= | last post by:
I have set the names of each column on design-time, but the code below could not get their names, why? thank you. //////////////////////////////////////////////////////////////////////// For...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.