I know there’s a few ways to do this but I’d like to ask for the experience of the group. I have an app that connects to a database. The IP address used for the connection may be one of three depending on the location of the user. That would be inside the facility, outside the facility, or on the machine itself. I want the user to set that. I’d like the app to attempt a connect and then, upon failure, put up a dialog of some sort where the user can enter or select the correct IP.
I’ve considered a property, a variable, and preferences. Preferences seems like more work than I want to do at this point.
How about a combo box which allows the user to enter the IP or select from the list. You can populate the list at run time or design time. But, if you want the list to be dynamic but still remember the last possible IPs you will need some way to store them and I would suggest something as simple as a TextStream.
Another option is if the IPs are static, why not have the application try to connect, if it fails, try the next, then the next, etc.? If after trying all of them alert the user - not sure what your options would be if all three fail though…
This last suggestion is probably the best. Simple enough and I don’t think the user would notice any delay.