Setting column widths in Listview control 
Author Message
 Setting column widths in Listview control

Hi,

I am using a listview box in my project to display data in the report
format. All the columns need to be set at different widths as is
possible with the grid control. How do I do this with the listview
control, like you do with the colwidth property of the grid?

Any help appreciated!

Chris



Sun, 24 Oct 1999 03:00:00 GMT  
 Setting column widths in Listview control

Quote:

> Hi,

> I am using a listview box in my project to display data in the report
> format. All the columns need to be set at different widths as is
> possible with the grid control. How do I do this with the listview
> control, like you do with the colwidth property of the grid?

> Any help appreciated!

> Chris

You actually need to set the Width of the ColumnHeader Object. The
syntax is ListView1.ColumnHeaders(index).width


Mon, 25 Oct 1999 03:00:00 GMT  
 Setting column widths in Listview control



Quote:
> Hi,

> I am using a listview box in my project to display data in the report
> format. All the columns need to be set at different widths as is
> possible with the grid control. How do I do this with the listview
> control, like you do with the colwidth property of the grid?

> Any help appreciated!

> Chris

Chris,

The listview control has a ColumnHeaders property, which references a
collection of Column Headers.  A Column Header has a property of width that
you can set ...

Dim colX As ColumnHeader ' Declare variable.
Dim intX as Integer ' Counter variable.
For intX = 1 to 4
        Set colX = ListView1.ColumnHeaders.Add()
        colX.Text = "Field " & intX
        colX.Width = ListView1.Width / 4
Next intX

Cheers,

Phil.



Tue, 26 Oct 1999 03:00:00 GMT  
 Setting column widths in Listview control

Quote:

>Hi,
>I am using a listview box in my project to display data in the report
>format. All the columns need to be set at different widths as is
>possible with the grid control. How do I do this with the listview
>control, like you do with the colwidth property of the grid?
>Any help appreciated!
>Chris

Here's how I did it. Example: set column 6 to a quarter of the total
width of the entire listview (named lstvXfrs):

lstvXfrs.ColumnHeaders(6).Width = (lstvXfrs.Width / 4)

of course you can set it to any valid number you'd like.

- Mike



Tue, 26 Oct 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. ListView column width = ListView width ?

2. Setting datagrid column width sets width of toplevel!!

3. Listview: Auto set column width?

4. Setting COLUMN WIDTH in LISTVIEW box

5. setting column widths in a listview

6. ListView - set column width via program

7. Setting listview column widths in code

8. ListView: Setting Column Width

9. ListView: Setting column width

10. ListView - problems setting column widths

11. Setting ListView Column Width

12. Total width of columns = Width of ListView

 

 
Powered by phpBB® Forum Software