博客
关于我
asp.net 4.5 练习~test14-8
阅读量:303 次
发布时间:2019-03-03

本文共 2301 字,大约阅读时间需要 7 分钟。

webform1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="test14_8.WebForm1" %>

请输入文件夹名称

webform1.aspx.cs

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.IO;namespace test14_8{    public partial class WebForm1 : System.Web.UI.Page    {        protected void Page_Load(object sender, EventArgs e)        {        }        protected void Button1_Click(object sender, EventArgs e)        {            string path = TextBox1.Text;            if (path == string.Empty) return;            int action = 0;            if (RadioButton1.Checked)            {                action = 1; // 创建             }            if (RadioButton2.Checked)            {                action = 2; //删除            }            switch (action)            {                 case 1:                    if (Directory.Exists(path))                    {                        lblTips.Text = "文件夹已存在!";                        return;                    }                    else                    {                        DirectoryInfo dr = Directory.CreateDirectory(path);                        lblTips.Text = "";                        lblTips.Text += "创建时间:" + dr.CreationTime + "
"; lblTips.Text += "父文件夹:" + dr.Parent + "
"; } break; case 2: if (Directory.Exists(path)) { try { Directory.Delete(path); lblTips.Text = ""; lblTips.Text = "文件夹已删除!"; } catch (Exception ex) { lblTips.Text = ex.Message; } } else { lblTips.Text = "文件夹不存在!"; } break; default: return; break; } } }}

 

转载地址:http://ydrm.baihongyu.com/

你可能感兴趣的文章
MySQL 索引连环问题,你能答对几个?
查看>>
Mysql 索引问题集锦
查看>>
Mysql 纵表转换为横表
查看>>
mysql 编译安装 window篇
查看>>
mysql 网络目录_联机目录数据库
查看>>
MySQL 聚簇索引&&二级索引&&辅助索引
查看>>
Mysql 脏页 脏读 脏数据
查看>>
mysql 自增id和UUID做主键性能分析,及最优方案
查看>>
Mysql 自定义函数
查看>>
mysql 行转列 列转行
查看>>
Mysql 表分区
查看>>
mysql 表的操作
查看>>
mysql 视图,视图更新删除
查看>>
MySQL 触发器
查看>>
mysql 让所有IP访问数据库
查看>>
mysql 记录的增删改查
查看>>
MySQL 设置数据库的隔离级别
查看>>
MySQL 证明为什么用limit时,offset很大会影响性能
查看>>
Mysql 语句操作索引SQL语句
查看>>
MySQL 误操作后数据恢复(update,delete忘加where条件)
查看>>