Hi
I've had a few error messages with this I don't understand why. It works fine in a Windows Form, but now moving it to a website, it's not working. I don't have the option to count the lines as I did with Windows Forms so I assume the best way is to use the split method. However, the split method only returns Character Arrays, and I want a string, so am calling the split from the Text.RegularExp ression namespace.
I am trying to split the lines entered into a multiline textbox line by line, and then peform some logic in each array.
I am told it can't convert char to string.
My code
Any ideas what I've done wrong? Or is the foreach loop only reads strings?
I've had a few error messages with this I don't understand why. It works fine in a Windows Form, but now moving it to a website, it's not working. I don't have the option to count the lines as I did with Windows Forms so I assume the best way is to use the split method. However, the split method only returns Character Arrays, and I want a string, so am calling the split from the Text.RegularExp ression namespace.
I am trying to split the lines entered into a multiline textbox line by line, and then peform some logic in each array.
I am told it can't convert char to string.
My code
Code:
string[] arrS = System.Text.RegularExpressions.Regex.Split(txtS.Text,Environment.NewLine);
foreach(string st in Convert.ToString(arrS))
{
//code
}
Comment