| 发表于:2007-03-17 19:32:194楼 得分:0 |
这个题目我做了一些小的研究,下面是我的代码:批量重命名文件 窗体控件: drivelistbox dirlistbox filelistbox text1box text2box text3box combobox command1 (确定) command2 (退出) label1.caption=选中目录 label2.caption=新文件名 label3.caption=扩展名 '========================= 代码内容 private sub combo1_click() text3.text = combo1.list(combo1.listindex) text3.refresh end sub private sub form_load() '选择默认路径 dim nn as string '将扩展名存为变量调用 nn = "*. " & text3.text dir1.path = app.path & "\ml " file1.pattern = nn file1.path = dir1.path text2.text = file1.path end sub private sub drive1_change() '选择驱动器 dir1.path = drive1.drive end sub private sub dir1_change() '选择文件夹 file1.path = dir1.path text2.text = file1.path end sub private sub file1_click() text2.text = file1.path & "\ " & file1.filename end sub private sub command1_click() '批量重命名文件 dim tt as string dim dd as string for i = o to file1.listcount - 1 file1.listindex = i dd = file1.path & "\ " & file1.filename tt = file1.path & "\ " & text1.text & i & ". " & text3.text name dd as tt '重命名文件 next i file1.refresh end sub private sub command2_click() end end sub private sub command3_click() nn = "*. " & combo1.list(combo1.listindex) file1.pattern = nn file1.refresh end sub | | |
|