I have a frustrating problem. With the following code in my clsExchange which is called in my FormExchange with simply txtPhonesInSystem.Text = ClsExchange.listPhones();I can only display the first arraylist entry.
public string listPhones()
{
string strphone = string.Empty;
foreach (clsPhone phone in phoneArray)
{
strphone = (strphone + phone.PhoneNumber.ToString() + "\n");
return strphone;
}
return strphone;
}
However, if i take the logic and put in in the btn_press event on the form.cs it displays the complete contents. The only difference I can see is instead of return strphone I use txtbox.Text=strphone. Any suggestions greatly appreciated aS I have been at this all day.
EDIT Thankyou all for your answers. I new it had to be something as simple as that. I guess my brain isn't made right for this stuff. Shame because I love it.