比如找文件夹1,查找出每个盘中文件夹1的位置,显示在列表中.利用vb.net,vb.net 很好用的但是资料好少
1条回答 默认 最新
- 浪客 2021-08-04 10:28关注
大概这样子,供参考。
Imports System.IO Public Class Form1 Private Function getDir(cdir As String, find As String) As String Dim sDir() As String Dim sre As String = "" Try sDir = Directory.GetDirectories(cdir) If sDir.Length = 0 Then Return sre Catch ex As Exception Return "" End Try Dim t As String For Each s In sDir If find.Length < s.Length Then t = s.Substring(s.Length - find.Length) If t = find Then sre += s + vbCrLf End If End If sre += getDir(s, find) Next Return sre End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim sfile As String = TextBox1.Text If sfile = "" Then Return Dim sGetFile As String = "" Dim drivers() As DriveInfo drivers = DriveInfo.GetDrives() For Each d In drivers sGetFile += getDir(d.Name, sfile) Next TextBox2.Text = sGetFile End Sub End Class
解决 无用评论 打赏 举报
悬赏问题
- ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
- ¥15 MCNP里如何定义多个源?
- ¥20 双层网络上信息-疾病传播
- ¥50 paddlepaddle pinn
- ¥20 idea运行测试代码报错问题
- ¥15 网络监控:网络故障告警通知
- ¥15 django项目运行报编码错误
- ¥15 STM32驱动继电器
- ¥15 Windows server update services
- ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏