Quick question:
I'm using a Microsoft.VisualBasic.Interaction.InputBox
in my C# code to allow users to add websites to a list, but I don't want them to enter an empty string so I give an error popup in case that happens. However, the error will also pop up if the user presses "cancel", which I don't want to happen.
Reading the documentation on it says that pressing "cancel" returns an empty string, hence why it fires the error. Is there a way to still define wether the user pressed "okay" with an empty string or "cancel"?
Thanks in advance,
-Peter
You can't do this. From MSDN
If the user clicks Cancel, a zero-length string is returned.
The easiest solution is just to create your own simple input form and test the
DialogResult
value