简体   繁体   English

VB.NET根据目录中的文件生成标签

[英]VB.NET Generating labels based on files from a directory

我需要根据目录的文件名生成一些标签。请帮助

U can use this cmd command in vb to generate a text file containing all file name of a folder U可以在vb中使用此cmd命令生成包含文件夹的所有文件名的文本文件

   Process.Start("cmd", "/c c: & cd\ & cd windows & dir > filename.txt")

then do what u wanna do with the file 然后做你想做的事情

To add labels 添加标签

  Public sub Form_load
  Textbox1.text(File.ReadAllLines(txt file location that was createdd earlier))

  'add a flow layout panel
   For each line in txtbox1.Lines
   dim lbl as new label
   Flpanel1.controls.add(lbl)
   using i as integer
   lbl.text=txtbox1.lines(i)  
   next

This is untested...let me knowow if it works 这未经测试...让我知道它是否有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM