hello ,
here is my code below to unzip a file and list only the file names contend in that folder in the listbox below , the code is working properly however am unable to get only the file name in the list box. In the listbox i get entire file path, which i dont want, i want only the filename to be listed...plz check out n let me know where am going wrong !
Help would be appreciated.

private void cmdok_Click(object sender, EventArgs e)
        {
            string Root = null;
            if (txtdestination.Text == null)
                MessageBox.Show("Invalid Path");
            else
                Root = folderBrowserDialog1.SelectedPath.ToString();
            txtdestination.Text = Root;
            DisplayFiles(Root);

        }
        public void DisplayFiles(string DirPath)
        {
             string Root = null;
             Root = txtdestination.Text;
             string[] FileList = Directory.GetFiles(DirPath);
             string[] DirList = Directory.GetDirectories(DirPath);
           // string Filename = Filename.ToString();
            foreach(string Filename in FileList)
            {
               listBox1.Items.Add(Filename.Substring(Filename.LastIndexOf("\"") + 1));
                //listBox1.Items.Add(Root.Substring(Root.LastIndexOf("\"") + 1));
                }
              foreach (string  DirName  in DirList)
                {
                    DisplayFiles(DirName);
            }

got it myself....sorry for d trouble !!!

cya
Rohan

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.