mohai
New Member
Posts: 7
|
Post by mohai on Nov 11, 2022 17:18:10 GMT
Hello all !!! Nice to see the qB64 project is still going on. I updated to version 2.0.2 version and found an odd quirk. I do not know if this is an improvement or a bug, but it is odd for me, as I am working on an old project now and found out that I will have to change my code in many functions. In the previous versions, inside a "function" my code was able to check the returning value of the function itself (condition "IF"), just using the function name without any parameter. Now this is not possible. I am only getting error messages ("Incorrect numbers of arguments passed to function in line xxxx". Find below an extract of an actual function that is causing this errors: Function GetSaveFileName$ (Title$, InitialDir$, Filter$, FilterIndex&, Flags&, hWnd&&) (omitted here some code to do some important stuff If Len(GetSaveFileName_t$) > 0 And Mid$(GetSaveFileName_t$, Len(GetSaveFileName_t$) - 3, 1) <> "." Then <<< this code causes error
. . . GetSaveFileName$ = GetSaveFileName_t$ <<< I had to add an extra variable as a workaround End Function
The "IF" command did not reported any any error in previous versions but, form version 2.0.2, it does. Is it a bug or new characteristic?
|
|
dbox
Junior Member
Posts: 89
|
Post by dbox on Nov 11, 2022 19:11:59 GMT
|
|
|
Post by bplus on Nov 11, 2022 20:07:25 GMT
Yes I am still changing old code like Text Fetch I just posted. We changed version numbers to 2.+ just because of this break in compatible code to past. Welcome mohai
|
|
tonylazuto
New Member
Tony Lazuto says hello
Posts: 25
|
Post by tonylazuto on Nov 12, 2022 4:08:06 GMT
You're going to want to store the result of the file dialog into a variable and use that. You shouldn't be storing a value in the function's name until you are ready to return a value.
|
|
mohai
New Member
Posts: 7
|
Post by mohai on Nov 12, 2022 10:46:14 GMT
Thank you.
For old QB, I guess this behavior was done to avoid loops inside functions.
|
|