Listview Question

I have a listview that contains data that I'm pulling back from a database, which works great.

Now I want to add a URL to the end of a description field, when certain criteria is meet, and that works.

The problem that I have is that the URL is not clickable within the listview. Is there a setting I'm missing like the richtextbox detecturl's for the listview, or is there another way to recognize that text as a link so that I can do a onclick event

Secondly, once I get the click working, I'll want to add an image rather than the URL in the listview, is it possible to load an icon sized image in the listview for the url




Answer this question

Listview Question

  • Pickleface

    Hi Jeff,

    I believe that the ListViewHitTestInfo class will get you most of what you want. Basically you do a HitTest call like:

    objItem = lvwResults.HitTest(lvwResults.PointToClient( _ System.Windows.Forms.ListView.MousePosition))

    that gives you an Info class which has the item, subitem and location (over label, image, below client area, left of item, etc)

    I think you can use that to identify the cell that the user clicks and execute the URL.

    I haven't used images with the new listview yet, but it does appear to allow an image index for subitems. As long as you can translate an image to URL, it should work the same.

    Good luck,

    Scott


  • Jay McLain

    ListView.HotTracking Property may be what you looking for

    http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.hottracking(VS.80).aspx

     

     This is for .Net framework 2.0 development, VB 2005


  • Listview Question