Serhan Srhn

Serhan Srhn

  • NA
  • 9
  • 9.1k

mouse double click in listview?

Dec 3 2014 8:11 AM
I have a listview and want to show folders in C drive in listview. but when I clicked double to listview, it doesn't show folders in folder, for example; folders in program files. I wonder how can I list folders in C drive by mouse duble clicking?
 
 private void lstw_MouseDoubleClick(object sender, MouseEventArgs e)
{
for (int i = 0; i < lstw.Items.Count; i++)
{
if (lstw.Items[i].Selected == true)
{
string path = lstw.Items[i].Name;
lstw.Items.Clear();
listFill(path);
}
}

}

private void listFill(string pth)
{
DirectoryInfo dInfo = new DirectoryInfo(pth);

try
{

foreach (DirectoryInfo di in dInfo.GetDirectories())
{
lstw.Items.Add(di.Name,di.FullName);
}
}
catch { }
}
 
 
 
 
 
 
 
 

Answers (7)