Solved

How do I lock Listview column widths/headers?

Posted on 1998-12-08
7
453 Views
Last Modified: 2013-12-25
Damned if I can find it. I want to prevent the user from resizing column headers when a listview's in report view. This is because I use zero width columns to hold reference data (eg. customer primary key) and the user can access this by simply playing with the column widths. I want the listview to basically ignore user attempts to modify the column width. Help!
0
Comment
Question by:deal051298
  • 3
  • 3
7 Comments
 

Author Comment

by:deal051298
ID: 1488808
Edited text of question
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1488809
you can use a tricky way , by making the style of the listview  [ listview.view=2 ] is list, and use labels instead od headers.


0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1488810
A better solution for the 0 length columns is to use the tag property of Listitem object with a variant array

Dim x as string(4)
Dim li as listitem
x(1) = "Hello"
x(2) = "Othervalue"
.
li.tag = x


0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 13

Expert Comment

by:Mirkwood
ID: 1488811
I couldnot find any easy method to lock them.
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 200 total points
ID: 1488812
A better solution for the 0 length columns is to use the tag property of Listitem object with a variant array

Dim x as string(4)
Dim li as listitem
x(1) = "Hello"
x(2) = "Othervalue"
 
li.tag = x

0
 

Author Comment

by:deal051298
ID: 1488813
Thanks Mirkwood! Has been implemented. Still would like to lock the column headers but your quick response meant I could get on with this under a tight deadline! And it solves my "user seeing data they're not supposed to" problem!
0
 

Author Comment

by:deal051298
ID: 1488814
For future reference it should be noted that the syntax for the array I used was:
dim x(0 to 3) as variant //can be (3 to 30),(1 to 4) or whatever

the syntax Mirkwood gave me was incorrect. Also to retrieve the tag just use:

(whatever here).tag(1) //or 0,2,3 as the array permits
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now