Hiding columns in ListView
-
Hi, I am new to vb.net and to this forum. Can anyone let me know how i can hide a listview column? I am using the standard listview control available in the windows forms. I have set the view of the listview as Details. I need to hide the first column and for that i set the width property of the first column to zero. This makes the list view column invisible during the runtime. However if i place my cursor on the listview header and drag the same, the first column appears. Is there anyway to hide the firstlistview column? Thanks in Advance Subha Subha Narayanan
-
Hi, I am new to vb.net and to this forum. Can anyone let me know how i can hide a listview column? I am using the standard listview control available in the windows forms. I have set the view of the listview as Details. I need to hide the first column and for that i set the width property of the first column to zero. This makes the list view column invisible during the runtime. However if i place my cursor on the listview header and drag the same, the first column appears. Is there anyway to hide the firstlistview column? Thanks in Advance Subha Subha Narayanan
Hello, There is no other way to do it. You implemented is right thing. I just have a additional to tell you. Assign ColumnResize value to none means one can not resize the column. Then while filling data in ListView calculate the length of the record which you are filling currently. Then assign the record lenght value to the column width. By doing this, you will able to see full length data in your ListView without facing problem. Example for consideration: Dim iLenght as Integer ' Lenght of the record Dim iPrevMaxLength as Integer ' Length of previous record iLength = 0 iPrevMaxLength = 0 While(rs.EOF != NULL) 'Todo part ..... ..... ..... ..... iLength = len(rs.CurrentRecord) if iLength > iPrevLength then ListView.Column(index).width = iLength iPrevMaxLength = iLength end if ' Todo part ..... ..... ..... ..... Wend Let me know if this works or not. Regards, Vilas Shewale ;)