C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




create a directory in C#.net


Posted Date: 03 Jun 2008    Resource Type: Code Snippets    Category: C# Syntax

Posted By: antogladwin       Member Level: Silver
Rating:     Points: 1



if(system.IO.Directory.Exists(c://gg==false))//we r checking the folder "gg",already available in drive c: or not
(
System.IO.Directory.Createdirectory("C:\\gg//");
System.IO.File.Create("C:\\gg//textbox1.text");//textbox1 having the file name.
}
else
{
response.write("ALREADY FOLDER EXIST");
}
}




Responses

Author: Payal Jain    04 Jun 2008Member Level: Gold   Points : 1
instead of
System.IO.File.Create("C:\\gg//textbox1.text");

we will be using it like this
System.IO.File.Create("C:\\gg//" + textbox1.text);


Author: antogladwin    13 Jun 2008Member Level: Silver   Points : 2
hi payal,

its ok frnd...
in that we check whether that directory is already available or not...if not only create or display the message...k friend..

System.IO.File.Create("C:\\gg//textbox1.text");

this line z also available in my coding(3,4 lines).
anyway thank u for ur comments..
thank u,



Author: Payal Jain    13 Jun 2008Member Level: Gold   Points : 2
but my frnd ...i mean to say...if the filename is present in textbox....then directory create command will not have parameters as u passed ...in your case it will create a file with name "textbox.text"...not with the name given in your textbox.....

so to create it with the name from textbox....we will write it as i said

System.IO.File.Create("C:\\gg//" + textbox1.text);


hope u got my point


Author: Kapil Dhawan    16 Jun 2008Member Level: Gold   Points : 1
Hello,
Nice piece of Code.
Thanks for sharing your knowledge with us.

Regards,
Kapil


Author: Kapil Dhawan    16 Jun 2008Member Level: Gold   Points : 1
Hello,
Nice piece of Code.
Thanks for sharing your knowledge with us.

Regards,
Kapil


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: convert an integer to an enum
Previous Resource: days between two dates in C#.NET
Return to Discussion Resource Index
Post New Resource
Category: C# Syntax


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use