کار با فایل و پوشه
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string a = textBox1.Text;
Boolean b=Directory.Exists(a);
if
(b == true)
MessageBox.Show("This Folder Exists Please Rename Folder");
if
(b==false)
Directory.CreateDirectory(a);
MessageBox.Show("Insert");
}
private void button2_Click(object sender, EventArgs e)
{
string a = textBox1.Text;
Boolean b = Directory.Exists(a);
if(b==false)
MessageBox.Show("This File Not Exists");
else
Directory.Delete(a);
MessageBox.Show("Delete");
}
private void button3_Click(object sender, EventArgs e)
{
// string a = textBox1.Text;
foreach (string f in Directory.GetDirectories(textBox1.Text)) ;
{
listBox1.Items.Add(f);
}
}
private void folderBrowserDialog1_HelpRequest(object sender, EventArgs e)
{
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
}
}
}
نظرات شما عزیزان: