You can do this to check what column/subitem was clicked. It just have to adapt it to your needs.
Dim colstart As Integer = 0
Dim colend As Integer = 0
Dim x As Integer
For x = 0 To (ListView1.Columns.Count - 1)
colend = colend + ListView1.Columns(x).Width
If colstart <= e.X And e.X <= colend Then
Label1.Text = "Column clicked: " & x + 1
Exit For
End If
colstart = colstart + ListView1.Columns(x).Width
Next
Thanks for the reply. As I mentioned in the Q, I like the layour that the listview gives in terms of creating groups etc. I don't know if this is possible in the datagridview.......
In your reply, how would I determine the item property though...i.e. the selected item?
I didn't want to do a full row select as I am displaying different backcolours for the subitems...maybe I will just have to live with the fact that I can't LOL!!!
I'll leave this q up to see if there is any more response
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Dim colstart As Integer = 0
Dim colend As Integer = 0
Dim x As Integer
For x = 0 To (ListView1.Columns.Count - 1)
colend = colend + ListView1.Columns(x).Width
If colstart <= e.X And e.X <= colend Then
Label1.Text = "Column clicked: " & x + 1
Exit For
End If
colstart = colstart + ListView1.Columns(x).Width
Next