title: C# : Get node name onClick in TreeView for a file manager
body: <p>I have to create a file manager from scratch and im stuck in the begining.</p>
  
  <p>It must show all drives name letter first.
  Then onclick shows folders an files in childnode and ... .</p>
  
  <p>Here is my <strong>question</strong>:</p>
  
  <ol>
  <li>How can i get node name (as a string) which is clicked ?</li>
  <li>Is it the right way to doing this?</li>
  </ol>
  
  <hr>
  
  <p>Here i first get drives name letter:</p>
  
  <pre><code>var drives = DriveInfo.GetDrives();
          for (var i = 0; i &lt; drives.Count(); i++)
          {
              var drivesletter = drives[i].Name;
              treeView1.Nodes.Add(drivesletter);
          }
  </code></pre>
  
  <p>Here i created a method, when you click on each node, <strong>node name should be saved in a Variable</strong>, then it will get list of all files and folders in it and add them to the node that we clicked on it:</p>
  
  <pre><code>private void treeView1_Click(object sender, TreeViewEventArgs e)
      {
          var nodename = treeView1.Nodes.Find("*", true); //this line suppose to get clicked node name
          var getdirs = Directory.GetDirectories(nodename); //error: It says nodename isnt string type
          foreach (var getdir in getdirs)
          {
              treeView1.SelectedNode.Nodes.Add(getdir);
          }
      }
  </code></pre>
  
  <p>If you have any source, example or something simple like what im going to make, its a big help.</p>