Sign in to follow this  
Guest bones

International programming 101

Recommended Posts

Ok, got my first lesson in international programming trying to distribute my autogen editing program. Seems many users were getting invalid property value errors when running my program. Turns out the problem stemmed from the fact that outside of the United States, it seems the world uses commas instead of periods in denoting a decimal value. I'm using masked edit boxes (cause I was too in a hurry and lazy to create custom controls) for entering the min and max values for vegetation heights and part of the mask includes the period for the decimal delimiter. Turns out if a user changes their global machine setting to use the dot instead of the comma, suddenly my program works. Have any of the other VB programmers out there found a simpler way of entering a decimal numeric value than the cludgy old masked edit box? I guess I could create an entry in the .ini file that denotes what character to use in the control mask but I'd sure like a more elegant way. Boy, how much work would it have been for the Microsoft engineers to include a numeric entry box in the tools? Have a new version compiled under the new VB6 service pack ready for distribution but I'm going to fix this comma/period thing first. Thanks for all the wonderful input I've received so far. I've incorporated many of the requests in the latest version including angled vegetation generation, freehand automatic multiple GUI object placement, and threw in some ideas of my own including the ability to quickly create custom GUI classes and the beginnings of code to create a mosaic of tiles for choosing the file to edit. Once I figure out how to order them, that feature will be ready. In the meantime, one can view the first 100 tiles or so laid out in alphabetical order on a mosaic window and click on them to choose the file.Art Martin

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hello Art,I sent earlier today the code for getting the custom name of agn files but it was returned:This is a permanent error; I've given up. Sorry it didn't work out.:64.12.138.185 failed after I sent the message.Remote host said: 554-: (CON:B1) http://postmaster.info.aol.com/errors/554conb1.html554 TRANSACTION FAILEDRegarding the decimal separator I decided to adopt "." although in my country we use "," to separate the integer and the fraction parts of a number. Not only I have boxes for the user to enter information but I have an INI file and, also, I export projects in plain TXT files which mainly consist of latitudes and longitudes. I think there is no way to fix this issue if users are going to exchange TXT files. If users only enter numbers in boxes may be the following is enough:/quote from MSDN/Note In Visual Basic, the Str and Val functions always assume a period is the decimal separator. In a majority of locales, this assumption is not valid. Instead, use the CStr, CDbl, CSng, CInt, and CLng functions to provide international conversions from any other data type to the data type you need. These functions use the system locale to determine the decimal separator./end of quote/Regards, Luis

Share this post


Link to post
Share on other sites

Luis, I added in the two parts that said (no spam)in my email address so that auto spammers wouldn't pick up the address from the website and start deluging me with messages about enlarging parts of my body. The first part is Azstrummer and the second part is @aol.com. Try that. lolArt

Share this post


Link to post
Share on other sites

Hi Art,Yes, I have also encountered this problems with almost any of my tools. As Luis already posted it depends on the commands you use when you write your output.I think the input box can have either dot or comma, that depends on the settings of the user PC. Internally VB always works with a dot, so if the user setting is comma it will be converted here. The problem comes when you write the output again, here it depends on the functions used (as Luis already indicated).I don't know where the problems arise for you, but in my CAT tool for example the problem only became clear when the comma was also written in the ASM source files. As BGLC can only work with dots in the source files.

Share this post


Link to post
Share on other sites

Hi Art,I understood that from the beginning. I only used "a" instead of "A" as the 1st character. I will send it again and see what happens.Luis

Share this post


Link to post
Share on other sites

Turned out I was preloading the value of the masked edit box by taking a numeric value and converting it to text with the format function. Little did I know that format would have a different output based on those international settings. It was an easy code fix to say if a comma was in the output of the format command then change the mask of the edit box accordingly. Problem fixed. I uploaded the newest version last night although it still hasn't shown up this morning yet. Probably when the today's file list comes out. Art

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this