Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 19th, 2007, 03:41 PM
Friend of Wrox
Points: 1,075, Level: 12
Points: 1,075, Level: 12 Points: 1,075, Level: 12 Points: 1,075, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: , , United Kingdom.
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default Closing Files

Well, in my app the user can open files which are obviously by code opened for input nd displayed into a grid which works fine (not hard to do at all) but when i they want to open another file the open dialog returns an error saying file already open even if its a different file completely! Why is that? When i open a file for input i do make sure that the file is closed afterwards!

------------------------------------------------
Apocolypse2005
Always ready and waiting to be helped!
__________________
Apocolypse2005, I'm a programmer - of sorts.
Reply With Quote
  #2 (permalink)  
Old August 21st, 2007, 07:10 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

are you using a diferent file number for each one??

how do you open it??

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
  #3 (permalink)  
Old August 21st, 2007, 02:10 PM
Friend of Wrox
Points: 1,075, Level: 12
Points: 1,075, Level: 12 Points: 1,075, Level: 12 Points: 1,075, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: , , United Kingdom.
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default

well i use this code
Code:
On Error GoTo DiEr

With cdSave
    .CancelError = True
    .DialogTitle = "Load Library"
    .Filter = "All Librarys(*.lstlib)|*.lstLib"
    .FilterIndex = 1
    .InitDir = App.Path

    .ShowOpen
  
    ReadPlaylist (.FileName)
End With

DiEr:
     If Err.Number = 32755 Then
        Exit Sub
    Else
    MsgBox Str(Err.Number) & ": " & Err.Description, vbCritical, "Error"
    End If
Which is the button handler and this code to open the file
Code:
Sub ReadPlaylist (sPath As String)
Open sPath For Input As #1
'code is executed in here!
Close #1

------------------------------------------------
Apocolypse2005
Always ready and waiting to be helped!
Reply With Quote
  #4 (permalink)  
Old August 21st, 2007, 02:17 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

well.. you are using the same number for every file.. use freefile to get a new number for a file.. that way you avoid trying to open one file in top of another...
Code:
dim i as integer
i = freefile
open file for input as i '(or was #i I don't remember)
HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing a Page. akhilhp ASP.NET 2.0 Basics 3 May 1st, 2007 10:03 AM
Form closing bschleusner C# 2005 2 February 4th, 2007 04:07 PM
VB not closing goLynxgo XML 0 January 26th, 2005 05:44 PM
Delete files on closing browser spacy ASP.NET 1.x and 2.0 Application Design 7 September 8th, 2004 04:24 PM



All times are GMT -4. The time now is 02:23 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.