Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. private FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
  2.  
  3.         public Form1()
  4.         {
  5.             InitializeComponent();
  6.         }
  7.  
  8.         string[] slupyPath;
  9.  
  10.         private void button1_Click(object sender, EventArgs e)
  11.         {
  12.             DialogResult result = folderBrowserDialog.ShowDialog();
  13.             if (result == DialogResult.OK)
  14.             {
  15.                 string folderName = folderBrowserDialog.SelectedPath;
  16.                 string[] slupy = Directory.GetDirectories(folderName);
  17.                 slupyPath = slupy.Select(y => Path.GetFileName(y)).ToArray();
  18.  
  19.                 ListViewItem[] x = new ListViewItem[slupyPath.Length];
  20.                 for(int i = 0; i < slupyPath.Length; i++)
  21.                 {
  22.                     x[i] = new ListViewItem(slupyPath[i]);
  23.                 }
  24.                 listViewPoles.Items.AddRange(x);
  25.             }
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement