OK - let's have another look at this...
There is some rather odd code there - I take it you don't know that a
string
can be treated as an array of
char
s? So you could replace this:
CustType = char.Parse(txtCustType.Text);
CustType = char.ToUpper(CustType);
txtCustType.Text = CustType.ToString();
With this:
txtCustType.Text = txtCustType.Text.ToUpper();
CustType = txtCustType.Text[0];
Which is a little more obvious.
But...personally I wouldn't mess about with characters anyway - use the strings directly instead! :laugh:
Secondly, you seem to spend a fair amount of time converting numbers and checking they are positive - are you restricted to using TextBoxes? Because if you aren't, then there is a handy control called a NumericUpDown - which can only ever hold valid numbers in a certain range, and needs no checking or conversion as it provides a
decimal
value directly. This could clean your code up lots!