Hi everyone,
Can anyone guide me how to stop scrolling a scrollbar.
regards,
BB
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Dec 31, 2009, 7:17 AM
private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
if (e.ItemIndex == listView1.Items.Count - 1)
{
listView1.Scrollable = false;
}
}
Rekha SinghPosted Dec 31, 2009, 4:24 AM
hi
ur code is perfectly fine .its working correctly if writen inside SelectedIndexChanged event of listview
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (listView1.Items[listView1.Items.Count - 1].Selected)
listView1.Scrollable = false;
else
listView1.Scrollable = true;
}
*****************************************
Please mark it Accepted if u find it helpful.
b bPosted Dec 31, 2009, 3:15 AM
Thanks for the reply. I am using ListView in windows application with C#. Actually, i have ListView which scroll with mouse operation. Once i reach the last record of the list i want to disable the scrolling. I used the following codes but its not working.
if (listView1.Items[listView1.Items.Count - 1].Selected)
{
listView1.Scrollable = false;
}
else
listView1.Scrollable = true;
}
Please help.
regards,
BB
Kirtan PatelPosted Dec 31, 2009, 2:58 AM
you can also just disable scrollbars
by following code
textBox1.ScrollBars = ScrollBars.None;