-
Kebo - GetSetting returns the value from the registry - according to the code that CodeErr wrote, it's fairly easy to assume that the values he/she's expecting to return are numeric or string....the only time a boolean will be returned is if that value is stored in the registry (and it is likely that it will be returned as string "True" or string "False" rather than 0 or 1, or True/False), OR if there is no value in the registry, the value False will be returned (using CodeErr's original code because thats the default value that he sends). Using the code I send through, the default value returned would be an empty string.
I try my hardest to stay away from implicit conversions (such as string "True" to boolean True ... I believe that its good programming technique to explicitly convert values if they are going to be retrieved in a different data type than the one you require.
In this case, all information in the registry is stored as string variables, so whatever is returned WILL be a string, although they MIGHT be implicitly converted if they 'fit' the datatype you require.
Might I also suggest that you don't call other people's posts "bogus" until you have checked them in their entirity and ascertained that all the information is false...which in this case, it isn't!
-
The post I was calling bogus was my accidental post that contained only half of what I was saying. I'm not the type of person to blatently call out someones elses stuff as bogus. sorry for the misunderstanding. As far as the registry values go I use what works and what takes the least amount of lines to code.
kevin
-
ok - my mistake! Sorry for the misunderstanding :)
I agree with using 'what works', but in this case, you cannot be sure of what will be returned from the registry - only if there's nothing in there will you get an explicit false.
You may get an implicit true if the value returned is non-zero and numeric...but why tempt fate (or tempt your program to crash!)