-
September 30th, 2011, 11:35 AM
#1
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
-
September 30th, 2011, 12:56 PM
#2
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!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|