The base class of all the exceptions is
. When you create your own exception class, you would need to derive from
or one of its derived classes.
When you handling exceptions, it gets processed sequentially. Thus you need to handle it the way you you have shown
MessageBox.Show("empty text box");
MessageBox.Show("Please enter only alphanumeric characters", "Input Problem", MessageBoxButtons.OK, MessageBoxIcon.Error);
catch (Exception ex)
The top most class needs to be the last in your catch block. Otherwise, the derived class below it won't be visible. The way you have the code is ok, and since
is your last catch block, as it should be, you don't have any exception at all. If you had any no matter of any exception type, it would have been caught by your last catch block.
So, your source of problem may not be exception.