Forum guidelines
AuthorQuestion
Mouse scroll with ListView
Posted By b b on 30 Dec 2009

Hi everyone,
I have a listview, where vertical scrollbar is there. On mouse scroll records in the listview selected one by one. What i want
is that, once the last item selected in the listview mousce scrolling operation have to stop. how to do that.
i am using C# with windows form.
 
regards,
BB

bb
AuthorReply
Re: Mouse scroll with ListView
Posted By Farooq Azam on 30 Dec 2009  
Add a SelectedIndexChanged event for the listView and use this code:

private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
       if (listView1.Items[listView1.Items.Count - 1].Selected)
       {
           listView1.Scrollable = false;
       }
       else
           listView1.Scrollable = true;
       }
}

Thanks

Download Free E-books

SPONSORED BY

JetBrains ReSharper Ultimate
.NET code analysis, refactorings, navigation, unit testing, code coverage and profiling in Visual Studio, a bonus for C++ devs, bundled at 50% off.