Re: vb-listview-plz help me out
- From: "Michael Cole" <noone@xxxxxxxxxx>
- Date: Thu, 11 Aug 2005 17:19:05 +1000
deepa.kr@xxxxxxxxxxxxxxx wrote:
> hi all.i have two listview's and i add items from one listview to
> another.i have the code below:
> Private Sub Command3_Click()
> Dim i As Integer
> For i = 1 To ListView1.ListItems.Count
> If ListView1.ListItems(i).Selected Then
> ListView2.ListItems.Add , , ListView1.ListItems(i).Text,
> ListView1.ListItems(i).Icon
> End If
> Next i
> For i = ListView1.ListItems.Count To 1 Step -1
> If ListView1.ListItems(i).Selected Then
> ListView1.ListItems.Remove (i)
> End If
> Next i
> End Sub
>
> The problem with the above is when the form gets loaded for the first
> time,the first item in the listview is moved to the second
> listview,without selecting the item, when i click the command button.
> if i place a breakpoint on "If ListView1.ListItems(i).Selected Then "
> the value shown is TRUE....but i have not at all selected the
> listviewitem....
Obviously, if the Selected property is true, then the item is selected.
Basically, the first item is selected by default. To deselect after load,
use this: -
If Not ListView1.SelectedItem Is Nothing Then
ListView1.SelectedItem.Selected = False
Set ListView1.SelectedItem = Nothing
End If
--
Regards,
Michael Cole
.
- Follow-Ups:
- Re: vb-listview-plz help me out
- From: deepa . kr
- Re: vb-listview-plz help me out
- References:
- vb-listview-plz help me out
- From: deepa . kr
- vb-listview-plz help me out
- Prev by Date: vb-listview-plz help me out
- Next by Date: Re: vb-listview-plz help me out
- Previous by thread: vb-listview-plz help me out
- Next by thread: Re: vb-listview-plz help me out
- Index(es):