This is in 2 parts involving the best declaration and FreeFile.
A while back a bit of a debate came out about which is better? Using global variables, or local to the function you are in.
I have long been a proponent of using globals...I can see the use in Globals because you declare once and then use as needed, but lately I can also see at some point perhaps you have 2 globals with the same name, or where do you declare the global?, the larger the program, the more globals, the harder it is to track down "Where did I declare it"? when you have not used it in a while.
In my VB past, for a while I used locals, and if something I needed global to several functions, I stored the value in the control that was displaying the current value. (but that slowed down response time, and eventually grew to many more lines of code for each function etc.) And storing the value in the control, is the same as having a global that gets changed when you change the control, right? (most cases that is)
MCM has been known to be a proponent for keeping variables local to the function they are being used in, and he ALMOST had me thinking storing the value in the control is worthwhile again since it is easy to find the variable (its right in your function) and the speed of PB (I see no discernible penalty with each function asking the current value, unlike what I saw in VB)
The one problem I saw was how to determine the current value from opening a file using freefile unless I stuck the value in a control (but I see no use for the filenumber in some control in this case, so wondered if a way to find the current value?)
The other part is:
Nevermind, I deleted it, the more I re-read to post my question the more obvious it became as to the answer.
but it involved MCM's explanation to why passing a file handle to a file, and then close the handle does not close the file.
Anyways, I guess the overall question is if I can get the file, or its handle without storing it in a control of a global so that the function that did not open it, can still use it?
(does any of this make any sense?)
A while back a bit of a debate came out about which is better? Using global variables, or local to the function you are in.
I have long been a proponent of using globals...I can see the use in Globals because you declare once and then use as needed, but lately I can also see at some point perhaps you have 2 globals with the same name, or where do you declare the global?, the larger the program, the more globals, the harder it is to track down "Where did I declare it"? when you have not used it in a while.
In my VB past, for a while I used locals, and if something I needed global to several functions, I stored the value in the control that was displaying the current value. (but that slowed down response time, and eventually grew to many more lines of code for each function etc.) And storing the value in the control, is the same as having a global that gets changed when you change the control, right? (most cases that is)
MCM has been known to be a proponent for keeping variables local to the function they are being used in, and he ALMOST had me thinking storing the value in the control is worthwhile again since it is easy to find the variable (its right in your function) and the speed of PB (I see no discernible penalty with each function asking the current value, unlike what I saw in VB)
The one problem I saw was how to determine the current value from opening a file using freefile unless I stuck the value in a control (but I see no use for the filenumber in some control in this case, so wondered if a way to find the current value?)
The other part is:
Nevermind, I deleted it, the more I re-read to post my question the more obvious it became as to the answer.
but it involved MCM's explanation to why passing a file handle to a file, and then close the handle does not close the file.
Anyways, I guess the overall question is if I can get the file, or its handle without storing it in a control of a global so that the function that did not open it, can still use it?
(does any of this make any sense?)
Comment