Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to tell what the file name is where VB6 has only assigned it a number?

Tags:

file

vb6

I'm working with some old VB6 code and it's still new to me. I know that in VB6 you assign an integer to represent a file. I have a program that uses quite a few files and it's tough to tell what file it's working with when it will only display the number when I mouse over the variable. (pic below).

enter image description here

So in the example above, how do i know what file #5 is?

Thanks

like image 795
JimDel Avatar asked May 31 '13 20:05

JimDel


Video Answer


2 Answers

You might have to modify the program to 'register' filenames with their file numbers:

Dim FileRegister as Collection

Dim FileName as String
Dim FileNumber as Integer

...

FileRegister.add FileName, str(FileNumber)
Open FileName For Output as #FileNumber

...

FileRegister.Remove str(FileNumber)
Close #FileNumber
like image 153
quamrana Avatar answered Sep 28 '22 08:09

quamrana


  • Search the code for the variable name? Do you have MZTools? It's a free plugin with excellent search facilities.
  • Trace the code execution back to see where the unit number comes from? Use the call stack view when debugging, or use MZTools to list all calls to any routine.
  • (Last resort) add logging.
    • Every time a file is opened, log the filename and unit number.
    • Every time a file is closed, log the unit number.
    • You could leave the logging in the production code, maybe with a way to turn it on/off at runtime. It could be useful again.
like image 34
MarkJ Avatar answered Sep 28 '22 07:09

MarkJ