By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,587 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,587 IT Pros & Developers. It's quick & easy.

How to creat Files and folders using VB6.0

akashazad
P: 38
Hi
guys in my application (VB6.0). I want to creat a folder in to which i want to creat a text file .

so is there any one who can give me code for that .

thankx in advance
Jun 5 '08 #1
Share this Question
Share on Google+
3 Replies


VijaySofist
100+
P: 107
Hi
guys in my application (VB6.0). I want to creat a folder in to which i want to creat a text file .

so is there any one who can give me code for that .

thankx in advance

Hi!

Use the FileSystemObject for this purpose. This is used for various operations with Files and Folders. For this you have to add the reference Microsoft Scripting Runtime.

For Example:
---------------------
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Dim fso As New FileSystemObject
  3. fso.CreateFolder ("D:\Vijay1")
  4. End Sub
  5.  
All the Best

Note: Please make the search before you post, because the answer for your question may available already in the forum.


With Regards
Vijay. R
Jun 5 '08 #2

Expert 100+
P: 487
You can create folder as vijay pointed and for txt files as below
Expand|Select|Wrap|Line Numbers
  1. Open "<File Path with txtFile Name>" For Output As #1 
  2.    For i = 1 To intNumberOfStringLines
  3.             Print #1, strStringToPrintInTxtFiles
  4.    Next i
  5. Close #1
Note: You should try your self, should not ask code directly, good luck
Jun 5 '08 #3

Ali Rizwan
100+
P: 927
You need to learn File System Object. It is a builtin class for vb by which there a lot of methods which control files, drives, folders etc. You can delete, create, modify etc using this class. You can write or read files. You can get attributes of drives, folders and files. To use the library/class add a refrence to it Microsoft Runtime Scripting.

And add this code to add the library in your app.

Dim FSO as new filesystemobject.

You can get online tutorials for it also. just google for it.

Regards
>> ALI <<
Jun 7 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.