• Welcome to Valhalla Legends Archive.
 

Bad File Name or #

Started by CrAz3D, March 20, 2004, 12:11 PM

Previous topic - Next topic

CrAz3D

I keep receiving this error when using my commands(the database is always saved after a commands is used)

Any ideas why I receive "Bad File Name of #"?...the file exsists
Public Sub WriteIt()
Close #1
Open (App.Path & "\database.db") For Output As #1
   For i = 1 To frmDB.DB.ListItems.Count
       Print #1, frmDB.DB.ListItems(i).text & " " & frmDB.DB.ListItems(i).ListSubItems(1).text & " " & frmDB.DB.ListItems(i).ListSubItems(2).text
   Next i
   Close #1
End Sub
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Adron

Maybe because you start by closing a file that's not open?

Grok

Public Sub WriteIt()
   Dim iFile As Integer
   iFile = FreeFile
   Open (App.Path & "\database.db") For Output As #iFile
   For i = 1 To frmDB.DB.ListItems.Count
       Print #iFile, frmDB.DB.ListItems(i).text & " " & frmDB.DB.ListItems(i).ListSubItems(1).text & " " & frmDB.DB.ListItems(i).ListSubItems(2).text
   Next i
   Close #iFile
End Sub


Fixed for you.

CrAz3D

Oooh, Grok = so 1337.

Thank you very much, I was attempting to do the same, but in a very primative way.
Input as #765 & so on
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...