We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

DiegoCP
Posts: 139
Joined: Fri Jan 23, 2015 1:02 pm

Change Selected Combo Index on System Currency

Hello,

So i have a combo box that was a few currencies.
What would be the best way of getting the system currency and selecting it as default in my combo.

For example:

I have Euro and Dollar.

If i was spanish then the combo selected value would be Euro.

It this feasible?

Thank You.

Best Regards,
Diego.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Change Selected Combo Index on System Currency

Hi Diego,

For this you can create you own custom action that will get the system currency and set the property attached to the combobox control. For details, please take a look on the Working with Windows Installer ComboBox and ListBox controls article.

For example, you can create your custom action as a custom action written in C# or a custom action written in C++.

Then you can go in the Custom Actions page and add a predefined Call function from attached native DLL custom action with sequence. Using this type of custom action you can call a function from a native DLL. The target DLL will be embedded in the MSI file but will not be deployed at install time with the other application files.

You can also take a look on the How to integrate and debug custom actions? article which may be useful to you.

Here's a piece of code that will implement your scenario:

Code: Select all

 [CustomAction]
       public static ActionResult curency(Session session)
       {
           string currencySimbol = Convert.ToString(System.Globalization.RegionInfo.CurrentRegion.CurrencySymbol);
           string currencyName = Convert.ToString(System.Globalization.RegionInfo.CurrentRegion.CurrencyNativeName);
           session["AI_COMBOBOX_DATA"] = "COMBOBOX_PROP|" + currencySimbol + "#" + currencyName;
           session["COMBOBOX_PROP"] = currencyName;
           return ActionResult.Success;
       }
Let me know if you have any questions.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
DiegoCP
Posts: 139
Joined: Fri Jan 23, 2015 1:02 pm

Re: Change Selected Combo Index on System Currency

Hello Daniel,

Thank You that exactly what i needed!

Best Regards,
Diego.

Return to “Building Installers”