使用c#.net创建带进度条的文件夹的代码 [英] code for creating folder with progress bar using c#.net
本文介绍了使用c#.net创建带进度条的文件夹的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用c#.net创建带进度条的文件夹的代码
解决方案
创建文件夹不会花费任何可观的时间,并且不是提供可用于报告进度的挂钩点的东西。创建文件夹只是调用 Directory.CreateDirectory
的情况,只要您具有在相关位置创建文件夹的相关权限。
我在表单中有一个按钮和进度条控件。下面的代码将在c:\中创建文件夹,同时点击按钮。
private void button2_Click( object sender,EventArgs e)
{
< span class =code-keyword> string [] folderName = { 一个 , 两个, 三个, 四个, 五};
progressBar1.Value = 0 ;
for ( int i = 0 ; i < 5 ; i ++)
{
Directory.CreateDirectory ( c:\\ + folderName [i]);
progressBar1.Value + = 20 ; // 由于我正在创建5个目录,我正在递增20(100/5)
}
}
最好的问候
Muthuraja
code for creating folder with progress bar using c#.net
解决方案
Creating a folder isn''t something that will take any appreciable amount of time, and isn''t something that provides the hook points that you could use to report progress on. Creating a folder is simply a case of calling Directory.CreateDirectory
, as long as you have the relevant permissions to create the folder in the relevant place.
Hi,
I have a button and progress bar control in the form. Below code will create folders in c:\ while button click.
private void button2_Click(object sender, EventArgs e) { string[] folderName = { "One", "Two", "Three", "Four", "Five" }; progressBar1.Value = 0; for (int i = 0; i < 5; i++) { Directory.CreateDirectory("c:\\" + folderName[i]); progressBar1.Value += 20; //Since I am creating 5 directory , I am incrementing 20 (100/5) } }
Best Regards
Muthuraja
这篇关于使用c#.net创建带进度条的文件夹的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文