I am trying to display files and it's size in a listview and it should show like it's in 2 columns.. but somehow it shows like this..
here's my code :
private void btnScan_Click(object sender, EventArgs e)
{
string path = cmbDrive.Text;
string extension1 = "*.png";
string extension2 = "*.doc";
string extension3 = "*.txt";
foreach (string s in FileUts.GetFiles(path, extension1).Union(FileUts.GetFiles(path, extension2)).Union(FileUts.GetFiles(path, extension3)))
{
FileInfo file = new FileInfo(s);
lvDBview.Items.Add(s);
lvDBview.Items.Add(BytesToString(file.Length));
}
You need to set ListView.View
property to List
:
lvDBview.View = View.List;
For more options visit here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.