Consulting

Results 1 to 4 of 4

Thread: ListView at runtime

  1. #1
    VBAX Regular
    Joined
    Sep 2009
    Posts
    57
    Location

    ListView at runtime

    Hi,

    I have created a form and at runtime it creates a listview using the following

    Set lstequip = Controls.Add("MSComctlLib.ListViewCtrl.2", "ListView1")

    is there a way of adding a double click event to the listview?

    before i used to add the listview at design time and when the program was run and the listview was populated i could double click on one of the lines and open up a different form. I havent been able to work out how to do this when its created at runtime.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Isn't DblClick one of its events. If you select the control and go to view code you should see it as an option in the dropdown.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Sep 2009
    Posts
    57
    Location
    yes it is when created at design time but this doesnt seem to work when created at runtime

  4. #4
    VBAX Regular
    Joined
    Sep 2009
    Posts
    57
    Location
    its ok i have found out how to do it. When i declared lstequip i did it as a listview. i change it from this to

    Public WithEvents lstequip As ListView

    now i can use

    Private Sub lstequip_dblclick()

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •