• Winform选择目录路径与选择文件路径


     1 using System.Collections.Generic;
     2 using System.ComponentModel;
     3 using System.Data;
     4 using System.Drawing;
     5 using System.Text;
     6 using System.Windows.Forms;
     7 namespace WindowsApplication1 {
     8 publicpartialclass SelectFolder: Form {
     9 public SelectFolder() 
    10 {
    11 InitializeComponent();
    12 }
    13 privatevoid btnSelectPath_Click(object sender, EventArgs e) //弹出一个选择目录的对话框
    14 {
    15 FolderBrowserDialog path = new FolderBrowserDialog();
    16 path.ShowDialog();
    17 this.txtPath.Text = path.SelectedPath;
    18 }
    19 privatevoid btnSelectFile_Click(object sender, EventArgs e) //弹出一个选择文件的对话框
    20 {
    21 OpenFileDialog file = new OpenFileDialog();
    22 file.ShowDialog();
    23 this.txtFile.Text = file.SafeFileName;
    24 }
    25 }
    26 }winforms 的openFileDialog1能实现 选择文件夹里面的多个<文件名>一次导入到LISTBOX下呢 !this.openFileDialog1.Multiselect = true;this.openFileDialog1.ShowDialog();foreach(string fName in this.openFileDialog1.FileNames){ this.listBox1.Items.Add(fName);}读取选择好的,文件全地址及名称
    27 OpenFileDialog openfiledialot = new OpenFileDialog();
    28             openfiledialot.ShowDialog();
    29             this.textBox1.Text = openfiledialot.FileName.ToString();
  • 相关阅读:
    ZZ: kvm qemu kqemu qemu-kvm libvirt
    ZZ:爬虫
    Mac下安装及配置Appium环境
    badboy使用手册
    如何正确做 Web端压力测试?
    关于web页面性能测量指标与建议
    Pycharm的使用一
    如何下载安装Python
    apache jmeter下载与安装
    但行其事,不问前程
  • 原文地址:https://www.cnblogs.com/pyffcwj/p/3062604.html
Copyright © 2020-2023  润新知