First you need to cancel the column-resize event as it is called (the first
sub below does this).
Next you need to reset the size back to 0 when the mouse is released (the
second sub does this).
You need both of these subs to make it work properly. Try it with just one
or the other to see what happens otherwise...
Private Sub ListView1_ColResizing(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ColumnWidthChangingEventArgs) _
Handles ListView1.ColumnWidthChanging
' called when the column is being dragged
' set the column index to whichever one you want to cancel:
If e.ColumnIndex = 1 Then
e.Cancel = True ' cancels the resize event, (stops the resize
from being displayed on the screen)
End If
End Sub
Private Sub ListView1_ColResized(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ColumnWidthChangedEventArgs) _
Handles ListView1.ColumnWidthChanged
' called when the mouse button is released
' set the column index to whichever one you want to cancel:
If e.Column = 1 Then
ListView2.Columns(1).Width = 0 ' reset size back to 0
End If
End Sub
"Maileen" <no*****@nospam.com> wrote in message
news:OT**************@TK2MSFTNGP09.phx.gbl...
Hi,
I have a listview in report mode.
I have 3 columns in this listview and 1 column i would like to hide it
from user's view.
i tried to give width = 0 but user is still able to resize column after in
runtime mode.
So, could someone help me please ?
thx,
Maileen