listview column: clicking via code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to fire the ColumnClick event for a Listview control remotely.
Problem is, I'm not sure what parameters to pass.

Here's the sub header for the event:

Private Sub Files_listview_ColumnClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.ColumnClickEventArgs) Handles Files_listview.ColumnClick

I'm *assuming* I can just use the listview control as the sender-- but I
have no idea what to use for e. I've dug through the docs and tried all
sorts of things but I get error messages that are unhelpful.

Now, I could be wrong in what the sender should be (the column itself
perhaps?) but regardless I am clueless on what to send for the
ColumnClickEventArgs and neither leaving the parameter blank nor using the
Nothing keyword are acceptabable.

Any and all help appreciated.

Thanks,

Randall Arnold
 
Use the index of the column you want to click:

Dim yourIndex as Integer = 2

Files_listview_ColumnClick(yourlistview, New
ColumnClickEventArgs(yourIndex))
 
Beautiful! Worked right off the bat. The only thing I hadn't tried was the
"New" keyword. I didn't think about why I had to at first but I get it now.
Thanks!

Randall
 
Back
Top