Click here to Skip to main content
12,999,633 members (79,072 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked
Posted 1 Dec 2011

InputBox: A simple user input dialog

, 1 Dec 2011
So here is a tip on how to improve upon this code. Do not silently catch exceptions! Instead, create a very simple logging mechanism that allows you to inspect the exception, either from code or during debugging.public static class InputBox{ public static Exception LastError {get; private...


Members may post updates or alternatives to this current article in order to show different approaches or add new features.

25 Dec 2011
3 alternatives  
A simple data entry dialog functionally similar to a MessageBox.
1 Dec 2011
Consider the scenario where the input value must be valid.public static double? GetDouble(string caption, string defaultValue, bool mustBeValid = false){ ClearLastError(); using (InputForm inForm = new InputForm(caption, defaultValue)) { while (true) { ...
25 Dec 2011
You have introduced a Globalization / Regional problem by requiring the default value to be a string.double? value = InputBox.GetDouble("xyz", "1.0"); //Note the dotdouble? value2 = InputBox.GetDouble("xyz", "1,0"); //Note the commaOne of these two will fail, but not on every machine or...


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
Netherlands Netherlands
Doing that 'computer thing' ever since the C64.

Sometimes I feel that being a programmer is much like being a doctor: You just have to know everything and if you don't, something dies.

Either being an appliction or a patient.
Oddly enough, more people care about the death of their application, than the massacre op people...

| | Privacy | Terms of Use | Mobile
Web02 | 2.8.170624.1 | Last Updated 1 Dec 2011
Article Copyright 2011 by Kabwla.Phone
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid