By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

Extended multiselect in .net listview

P: n/a
Hi all & Happy New year

What I want to do is be able to multiselect rows in a Listview just by
clicking & dragging the mouse over them (not using the shift key). So
has I move the mouse over each row it highlight & stays higlighted. I
can do it in vb6 (see code below), but not in .net

This in on the mouse_move action

If Button = vbLeftButton Then
lvtrades.SelectedItem = lvtrades.HitTest(X, Y)
End If

Cheers

All
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Have you considered a ListView with property CheckBoxes = True?

IMHO, it is better to stick to Windows standards rather than redefining the
behavior of controls, since it can confuse users.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
"Jonathan" <jo*****@bankofamerica.com> escribió en el mensaje
news:81**************************@posting.google.c om...
Hi all & Happy New year

What I want to do is be able to multiselect rows in a Listview just by
clicking & dragging the mouse over them (not using the shift key). So
has I move the mouse over each row it highlight & stays higlighted. I
can do it in vb6 (see code below), but not in .net

This in on the mouse_move action

If Button = vbLeftButton Then
lvtrades.SelectedItem = lvtrades.HitTest(X, Y)
End If

Cheers

All

Nov 21 '05 #2

P: n/a
Carlos & all

OK, but how do I get the row to be checked as the mouse passes over it
(not using hover, it's to slow)
Carlos J. Quintero [.NET MVP] wrote:
Have you considered a ListView with property CheckBoxes = True?

IMHO, it is better to stick to Windows standards rather than redefining the behavior of controls, since it can confuse users.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
"Jonathan" <jo*****@bankofamerica.com> escribió en el mensaje
news:81**************************@posting.google.c om...
Hi all & Happy New year

What I want to do is be able to multiselect rows in a Listview just by clicking & dragging the mouse over them (not using the shift key). So has I move the mouse over each row it highlight & stays higlighted. I can do it in vb6 (see code below), but not in .net

This in on the mouse_move action

If Button = vbLeftButton Then
lvtrades.SelectedItem = lvtrades.HitTest(X, Y)
End If

Cheers

All


Nov 21 '05 #3

P: n/a
"jo*****@bankofamerica.com" <jo*****@bankofamerica.com>'s
wild thoughts were released on 5 Jan 2005 07:46:18 -0800
bearing the following fruit:
Carlos & all

OK, but how do I get the row to be checked as the mouse passes over it
(not using hover, it's to slow)

While I don't like it, you could do something like

Private flgMouseDown as boolean

Private Sub ListView1_MouseDown(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
ListView1.MouseDown
flgMouseDown = True
End Sub

Private Sub ListView1_MouseLeave(ByVal sender As Object,
ByVal e As System.EventArgs) Handles ListView1.MouseLeave
flgMouseDown = False
End Sub

Private Sub ListView1_MouseUp(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
ListView1.MouseUp
flgMouseDown = False
End Sub

Private Sub ListView1_MouseMove(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
ListView1.MouseMove
If flgMouseDown = True Then
If ListView1.GetItemAt(e.X, e.Y) Is Nothing Then

Else
ListView1.GetItemAt(e.X, e.Y).Selected =
True
End If
End If
End Sub
Carlos J. Quintero [.NET MVP] wrote:
Have you considered a ListView with property CheckBoxes = True?

IMHO, it is better to stick to Windows standards rather than

redefining the
behavior of controls, since it can confuse users.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
"Jonathan" <jo*****@bankofamerica.com> escribió en el mensaje
news:81**************************@posting.google.c om...
> Hi all & Happy New year
>
> What I want to do is be able to multiselect rows in a Listview justby > clicking & dragging the mouse over them (not using the shift key).So > has I move the mouse over each row it highlight & stays higlighted.I > can do it in vb6 (see code below), but not in .net
>
> This in on the mouse_move action
>
> If Button = vbLeftButton Then
> lvtrades.SelectedItem = lvtrades.HitTest(X, Y)
> End If
>
> Cheers
>
> All

Jan Hyde (VB MVP)

--
All your base are belong to us.

[Abolish the TV Licence - http://www.tvlicensing.biz/]

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.