C# School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C# Expert!

Join 308,426 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 3,242 people online right now. Registration is fast and FREE... Join Now!




C# how to check and display the content of a folder.

 

C# how to check and display the content of a folder., How to scan the content of the folder and listed in textbox

dunk_6

15 Sep, 2009 - 10:57 PM
Post #1

New D.I.C Head
*

Joined: 3 Aug, 2009
Posts: 43



Thanked: 1 times
My Contributions
Hi all,

I'm not sure wether this topics has been disscussed before or not, but im not sure the exact word to search for it. What method/class should i used?? Any references/solution are very thankful. Thank you very much.

The program has 3 button: 1) for folder browsing, 2) scan for the selected folder content, and 3) open the file. When user browse the selected folder(1), user click scan button to scan from the first file until the last available files and listed it text box(2) and from that user can decide whether to open the files or not(3).

Here are what have i done so far..(no 1 & 3 ):
CODE
//for browse
private void browse2()
        {
            string strPath;
            string strCaption = "Select a Directory and folder.";
            DialogResult dlgResult;
            Shell32.ShellClass shl = new Shell32.ShellClass();
            Shell32.Folder2 fld = (Shell32.Folder2)shl.BrowseForFolder(0, strCaption, 0,
                        System.Reflection.Missing.Value);
            if (fld == null)
            {
                dlgResult = DialogResult.Cancel;
            }
            else
            {
                strPath = fld.Self.Path;
                dlgResult = DialogResult.OK;
                this.txtDest.Text = strPath.ToString();
            }
        }
//for open folder
private void btnOpen_Click(object sender, EventArgs e)
        {
            try
            {
                Process.Start(txtDest.Text);
            }
            catch
            {
                MessageBox.Show("Please select one file/folder");
            }
        }




User is offlineProfile CardPM
+Quote Post



Fast ReplyReply to this topicStart new topic

Time is now: 11/24/09 01:41PM

Live C# Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month