Hiiiiiiiiiiiiiiiiiii
In my project, I need code to list all subdirectories that are present in a specified main directory
I have some code with me
Plz check it out n tell me where I'm getting wrong and what steps I have to take n where
My code is:
csharp
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace search
{
public partial class Form1 : Form
{
string path;
string str;
string[] folders;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
folders = System.IO.Directory.GetDirectories(@"C:\", "*.txt", System.IO.SearchOption.AllDirectories);
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
textBox1.Text = listBox1.SelectedItem.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
saveFileDialog1.ShowDialog();
path=saveFileDialog1.FileName + ".txt";
System.IO.File.AppendAllText(path, textBox2.Text);
MessageBox.Show("File Saved.....", "Success");
}
private void button3_Click(object sender, EventArgs e)
{
str = System.IO.File.ReadAllText(textBox1.Text);
textBox2.Text = str;
}
private void button4_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
Thanx in advance

** Edit **
Also, please don't start duplicate topics of the same content. Topics merged.