Welcome to Dream.In.Code
Become a VB Expert!

Join 149,553 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,604 people online right now. Registration is fast and FREE... Join Now!




Creating folders with VB6

 
Reply to this topicStart new topic

Creating folders with VB6

cdm163
28 Nov, 2007 - 02:42 AM
Post #1

New D.I.C Head
*

Joined: 28 Nov, 2007
Posts: 11


My Contributions
I am currently creating a program for my course that requires me to create text files for transactions. I have already made a file that will hold the information but I wish to add more so that I can have multiple files that will contain text files for each transaction and store them in a folder marked with the date.

My problem is I do not know of any way in which folders can be created

my code so far...

CODE


Open "W:\filesaves\Transactions.txt" For Append As 1  'Opens or creates the file for storing transaction details

Print #1, ""                                           'Prints a gap from the last record
Print #1, ""

For X = 1 To 21

    If lstItems.List(X - 1) <> "" Then                           'Prints all items in the list to the text file
        Print #1, "Item name    " & lstItems.List(X - 1)
        Print #1, "Quantity     " & lstQnty.List(X - 1)
        Print #1, "Price        " & lstPrices.List(X - 1)
        Print #1, ""
    End If

Next X

Print #1, "Total Price £" & txtTotal.Text                          'Prints the total price
Print #1, ""
Print #1, Time, " " & Date                'Prints the time and date for the transaction
Print #1, "______________________________________________________"



I have tried to use the open command to create the folder but had an error message stating that the path cannot be found. I am currently using Visual Basic 6 for this application.
User is offlineProfile CardPM
+Quote Post

AbhishekKr
RE: Creating Folders With VB6
28 Nov, 2007 - 03:09 AM
Post #2

New D.I.C Head
*

Joined: 28 Nov, 2007
Posts: 6


My Contributions
MkDir is the function used
don't confuse with shell function of DOS, its working in VB 6.0

CODE
MkDir PathName & DirName


CODE
Example:

MkDir "c:\ABK_Dir"

This will create "ABK_Dir" folder in "C:\"


This post has been edited by AbhishekKr: 28 Nov, 2007 - 03:10 AM
User is offlineProfile CardPM
+Quote Post

cdm163
RE: Creating Folders With VB6
28 Nov, 2007 - 03:13 AM
Post #3

New D.I.C Head
*

Joined: 28 Nov, 2007
Posts: 11


My Contributions
Is there any chance that there is a way to use variables or other functions to the mkdir command ?

for example

CODE

mkdir("c:\transaction" &date)


This post has been edited by cdm163: 28 Nov, 2007 - 03:31 AM
User is offlineProfile CardPM
+Quote Post

AbhishekKr
RE: Creating Folders With VB6
28 Nov, 2007 - 03:44 AM
Post #4

New D.I.C Head
*

Joined: 28 Nov, 2007
Posts: 6


My Contributions
yes, you can directly use such concatenation
so if you just wanna use the Variables(holding Path or Folder Name) or other Functions(returning some values for Path or Folder Name) then you could use that

to make it look more easy first concatenate all Variables or Function name list in some Variable
then use that Variable in the function
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 09:53PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month