listview column: clicking via code

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
 
S

Some Guy

Use the index of the column you want to click:

Dim yourIndex as Integer = 2

Files_listview_ColumnClick(yourlistview, New
ColumnClickEventArgs(yourIndex))
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top