最近帮一个老学长,准研究生,做一个入学要交的作业,要求是C#/Python语言,我就想熟悉下C#。
大概需求如下图展示:
直接看代码:=====================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 作业
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void SelectedBtb_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Multiselect = false;//该值确定是否可以选择多个文件
dialog.Title = "请选择文件夹";
dialog.Filter = "文本文件(*.txt*)|*.txt*";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string file = dialog.FileName;
this.txtPath.Text = file;
}
else
{
MessageBox.Show("未选中txt文件");
}
}
private void Button1_Click(object sender, EventArgs e)
{