3 Replies - 14363 Views - Last Post: 28 November 2007 - 04:44 AM Rate Topic: -----

#1 cdm163  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 28-November 07

Creating folders with VB6

Posted 28 November 2007 - 03:42 AM

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...


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.

Is This A Good Question/Topic? 0
  • +

Replies To: Creating folders with VB6

#2 AbhishekKr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 28-November 07

Re: Creating folders with VB6

Posted 28 November 2007 - 04:09 AM

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

MkDir PathName & DirName


Example:

MkDir "c:\ABK_Dir"

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

This post has been edited by AbhishekKr: 28 November 2007 - 04:10 AM

Was This Post Helpful? 0
  • +
  • -

#3 cdm163  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 28-November 07

Re: Creating folders with VB6

Posted 28 November 2007 - 04:13 AM

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

for example

mkdir("c:\transaction" &date)


This post has been edited by cdm163: 28 November 2007 - 04:31 AM

Was This Post Helpful? 0
  • +
  • -

#4 AbhishekKr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 28-November 07

Re: Creating folders with VB6

Posted 28 November 2007 - 04:44 AM

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
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1