I have been tryingto make the columnheader of a listview fixed so the user want be able to modify it manually by mouse scrolling but i couldnt find any solution een giving it a fix width didnt work so any ideas i would be thankfull

try this sample

Dim C As ColumnHeader
 Dim i As Integer
 For i = 1 To 4
 Set C = LV1.ColumnHeaders.Add()
 C.Text = "Field" & i
 C.Width = LV1.Width / 4
 Next i

Edited 5 Years Ago by debasisdas: n/a

and this code doesnt fix headercolumn it makes the ones u set = 0 cant be changed
and it dont work niether :)

The index out of bounds error is because The Chosen copied and pasted your code as is. If there is a call to more columns than what exist in the list-view, the error is raised.

@The Chosen, you need to modify Das's code OR paste some of your own so we can see where your error occurred. Also include the line it error ed on.

why should i copy an error have nothing to do with my subject i can fix errors easily dont worry thanks for the code but it will not work i know this and i found a simple solution
it cant be done in visual basic much easier right?

in my question i simply said giving it a fix width didnt work so any ideas i would be thankfull.
AndreRet thanks for your comment

i didnt say ur code is wrong as a vb code it is good 100%
i meant the idea is wrong bec column width cant be fixed by giving a value of number or equal to listview width
its just cant be done as i commented before
thanks for ur time

This article has been dead for over six months. Start a new discussion instead.