Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5937315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:31:19+00:00 2026-05-22T15:31:19+00:00

I am using Visual Studio 2008 and VB.NET. I’ve got a listview control on

  • 0

I am using Visual Studio 2008 and VB.NET. I’ve got a listview control on my form and I’ve added columns using the windows forms designer. As you know, if you double-click on the sizer or divider or whatever you want to call it between two columns, the column on the left will autosize (unless you disable that). How can I catch this specific event? The ColumnWidthChanged event and the DoubleClick event are likely candidates, but in the ColumnWidthChanged event, there’s no way I can see to determine if it was an autosize. Similarly, there’s no simple way to catch what was clicked exactly with the DoubleClick event. Does anyone have any ideas how I can catch this specific event type?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:31:20+00:00Added an answer on May 22, 2026 at 3:31 pm

    Detecting events on a listview’s header is quite tricky.

    You will need to create your own header to replace the one that it normally uses, and then listen to the appropriate messages. There aren’t any specific ones for column resize handles, as far as I know.

    The following class subclasses ListView and adds a handler that detects a double-click between columns. That is as close as it gets, I think.

    I hope it will help you out somewhat.

        Class MyListView
            Inherits ListView
    
            Protected Overrides Sub CreateHandle()
                MyBase.CreateHandle()
                New HeaderControl(Me)
            End Sub
    
            Private Class HeaderControl
                Inherits NativeWindow
                Private _parent As ListView = Nothing
    
                <DllImport("User32.dll", CharSet := CharSet.Auto, SetLastError := True)> _
                Public Shared Function SendMessage(hWnd As IntPtr, msg As Integer, wParam As IntPtr, lParam As IntPtr) As IntPtr
                End Function
    
                Public Sub New(parent As ListView)
                    _parent = parent
    
                    Dim header As IntPtr = SendMessage(parent.Handle, (&H1000 + 31), IntPtr.Zero, IntPtr.Zero)
                    Me.AssignHandle(header)
                End Sub
    
    
                Protected Overrides Sub WndProc(ByRef message As Message)
                    Const  WM_LBUTTONDBLCLK As Integer = &H203
    
                    Select Case message.Msg
                        Case WM_LBUTTONDBLCLK
                            Dim position As Point = Control.MousePosition
                            Dim relative As Point = _parent.PointToClient(position)
    
                            Dim rightBorder As Integer = 0
                            For Each c As ColumnHeader In _parent.Columns
                                rightBorder += c.Width
                                If relative.X > (rightBorder - 6) AndAlso relative.X < (rightBorder + 6) Then
                                    MessageBox.Show([String].Format("Double-click after column '{0}'", c.Text))
                                End If
                            Next
                            Exit Select
                    End Select
    
    
                    MyBase.WndProc(message)
    
    
                End Sub
    
            End Class
        End Class
    

    You will need to include a using System.Runtime.InteropServices; statement for this to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an application for Windows Mobile Devices using Visual Studio .NET 2008 whose
I have developed a windows service using visual studio 2008 and .net fw 3.5.1
I'm using Visual Studio 2008 SP1 on .NET 3.5 SP1 on Vista Any time
Applications I am using: Visual Studio 2008 (C#/ASP.NET) Visual Source Safe 8.0 IIS 5.1
If I'm using Visual Studio 2008 targeted to ASP.NET 2.0, then which version of
I'm developing an ASP.NET 2.0 app using Visual Studio 2008. If I want to
I am using Firefox 3 to debug my ASP.NET applications in Visual Studio 2008.
Trying to do basic SSL-authenticated Web Service using Visual Studio 2008 .NET 3.5 Service
I am using Visual Studio 2008 | .NET 3.5 | C#. I have created
I'm using visual studio 2008 with .net 3.5. I have an AccessDataSource that is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.