How to use ScrollBars with Listview
Hi friends! I need some assistance Im trying to use a Scrollbar with a listview this is my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
listView1.Scrollable = true;
listView1.View = View.Details;
ListViewItem lvi = new ListViewItem("Adam");
lvi.SubItems.Add("416-485-9654");
listView1.Items.Add(lvi);
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}
so when I scroll down i see more and more of the information PLZ HELP
Re: How to use ScrollBars with Listview
Change your current code from what you have to this:
Code:
private void Form1_Load(object sender, EventArgs e)
{
listView1.Scrollable = true;
listView1.View = View.Details;
for (int i=0; i<250; i++)
{
ListViewItem lvi = new ListViewItem("Adam");
lvi.SubItems.Add("416-485-9654");
listView1.Items.Add(lvi);
}
}
The listview will normally default to showing and enabling horizontal and verticle scroll bars... but you have to fill the list beyond it's display capacity to trigger their use. :)
Best of luck!