winforms 的openFileDialog1如何才能实现 选择文件夹就能直接把里面的文件都导出来!

来源:百度知道 编辑:UC知道 时间:2024/05/28 15:52:17
winforms 的openFileDialog1如何才能实现 选择文件夹就能直接把里面的文件都导出来!

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 NoteBook
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
StreamReader sr = new StreamReader(ofd.FileName);
textBox1.Text = sr.ReadToEnd();
sr.Close();
}

}
}