Click to See Complete Forum and Search --> : How can I prevent the size of columns of my listview?


Sophia chin
March 28th, 2001, 08:55 PM
Hello,

Could you tell me how can I prevent the size of columns of my listview? Thanks.

Vijooo
March 28th, 2001, 11:06 PM
Hi
Are u talking about Sizing the Column or Resizing the Column.

U can use the below given statement for

Sizing the Column :-

ListView1.View = LVWReport
ListView1.ColumnHeaders.Add ,,300

The third argument is the Column Width. U can change that accordingly to ur wish.

Take Care Bye Bye
Vijooo

Sophia chin
March 28th, 2001, 11:37 PM
Thank you for your reply.

Actually I don't want the width of column can change. I want to lock it. Could you tell me how to do it?

Sophia chin
March 28th, 2001, 11:47 PM
Actually I don't want the size of columns of my listview can change. Could you tell me how can I do that?

Vijooo
March 29th, 2001, 03:31 AM
Hi

If u dont want ur LVW Column to be resized, then
i dont think that there r some solutions for ur requirements. But i suggest u a cheating way to
overcome this problem.

1) Place the following code in Form Load
Private Sub Form_Load()
ListView1.View = lvwReport
ListView1.ColumnHeaders.Add , , "Sample", 500
End Sub

2) Insert a Timer Control and set the Interval to
100.

3) Then Place the following code in the Timer.
Private Sub Timer1_Timer()
ListView1.ColumnHeaders(1).Width = 500
End Sub

This is the first way and there is another way also. U can use an API Call for that.

Const LVSCW_AUTOSIZE = -1
Const LVSCW_AUTOSIZE_USEHEADER = -2


All the Best. Reply me back

Take Care Bye Bye
Vijooo