002集—创建文件夹—VB.NET

VB.NET创建文件夹方法如下:

复制代码
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Try
        If Directory.Exists(TextBox1.Text) Then
            MsgBox("此目录存在")
            Return
        End If
        Dim di As DirectoryInfo = Directory.CreateDirectory(TextBox1.Text)
        MsgBox("创建成功")
    Catch ex As Exception
        MsgBox("文件异常", ex.ToString)
    End Try
End Sub

由下图可知,已创建新目录成功

相关推荐
Jeff-Tsai11 小时前
Day 11:数据访问层的连接、Transaction 与查询条件
.net·架构设计·erp·definition-driven
宝桥南山11 小时前
.NET 11 - 尝试一下Blazor中的新特性SupplyParameterFromTempData
microsoft·微软·c#·asp.net·.net·.netcore
rockey6271 天前
AScript之LINQ扩展
c#·.net·script·动态脚本
学以智用1 天前
runtimeconfig.json + appsettings 完整详解(.NET Core/.NET5+,对比 machine.config)
.net
qq_410194291 天前
.NET 性能优化:先找瓶颈,再谈技巧
性能优化·.net
玩泥巴的1 天前
把AI编码从自由生成到受约束声明:微信生态 .NET SDK 中用源生成器压制 AI 编码幻觉的工程实践
微信·.net·aot·roslyn
Jeff-Tsai2 天前
Day 10:多数据库支持:CRUD 与结构升级
.net·架构设计·erp·definition-driven
1-1=02 天前
C# 特性(Attribute)
c#·.net·.netcore
IT规划师2 天前
Redis 数据类型全解 - Bitmap 生产实战:把位视图讲准、用对、守住红线(六)
redis·.net