Hello,
I have made a web application program that takes one string and outputs it through an array into three seperate textboxes using comma seperated values.
This works fine - BUT I want data 0 to only allow entry of strings (it's a name),
data 2 to only allow entry of numbers (account number),
and data 3 to only allow entry of a string (password).
What I'm trying to work out is, if I have to somehow seperate every part with try catches or is there some more obvious and efficient way of dealing with errors in this case.
(If any of the above is nonsense - that is because I don't totally know what I am doing:)) Any advice gratefully received - thank you.
Here's the code
private void parseBut_Click(object sender, EventArgs e)
{
String namaccpas;
////Create the arrays to hold the data and the comma delimiter
String[] data = new String[3];
char[] chars = new char[] { ',' };
//Use textboxes to show records one at a time from the data array
namaccpas = namaccpasTextBox.Text;
data = namaccpas.Split(chars);
namTextBox.Text = (data[0]);
accTextBox.Text = (data[1]);
pasTextBox.Text = (data[2]);
}