I added these three components from tools menu/choose toolbox items; however they are not working when I changed the drive or directory..

here is the code of these three components in case they change

    private void driveListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            dirListBox1.Path = driveListBox1.Drive;
        }
        catch (Exception ex)
        {
            MessageBox.Show("Error : " + ex.Message,
                            "Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
        }
    }

    private void dirListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            this.fileListBox1.Path = this.dirListBox1.Path;
        }
        catch (Exception ex)
        {
            MessageBox.Show("Error : " + ex.Message,
                            "Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
        }
    }

    private void fileListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string fullPath = fileListBox1.Path + "\\" + fileListBox1.FileName;
        try
        {
            StreamReader sr = new StreamReader(fullPath);
            textBox2.Text = sr.ReadToEnd();
            textBox1.Text = fullPath;
        }
        catch (Exception ex)
        {
            MessageBox.Show("Error : " + ex.Message,
            "Error",
            MessageBoxButtons.OK,
            MessageBoxIcon.Error);
        }
    }

it is said that these components are compatible wth VB.NET, does it mean I can't use them in a C# project?

Edited 3 Years Ago by Dani: Formatting fixed

I tried them out in 2008, and the directory browser's path does not react correctly. You can add some text boxes to your form that are populated with the new path from this component as you select or even double click around on the dir component... It fails 90% of the time to update it own Path property.
I would look for an alternative solution.

// Jerry

I have used openfiledialog class instead of the components above and it works fine now.. anyway thanx for the reply jerry..

This question has already been answered. Start a new discussion instead.