How to creat Files and folders using VB6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akashazad
    New Member
    • Sep 2007
    • 38

    How to creat Files and folders using VB6.0

    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
  • VijaySofist
    New Member
    • Jun 2007
    • 107

    #2
    Originally posted by akashazad
    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 FileSystemObjec t 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:
    ---------------------
    Code:
    Private Sub Command1_Click()
    Dim fso As New FileSystemObject
    fso.CreateFolder ("D:\Vijay1")
    End Sub
    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

    Comment

    • CyberSoftHari
      Recognized Expert Contributor
      • Sep 2007
      • 488

      #3
      You can create folder as vijay pointed and for txt files as below
      [CODE=vb]Open "<File Path with txtFile Name>" For Output As #1
      For i = 1 To intNumberOfStri ngLines
      Print #1, strStringToPrin tInTxtFiles
      Next i
      Close #1[/CODE]
      Note: You should try your self, should not ask code directly, good luck

      Comment

      • Ali Rizwan
        Banned
        Contributor
        • Aug 2007
        • 931

        #4
        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 filesystemobjec t.

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

        Regards
        >> ALI <<

        Comment

        Working...