i am trying to make acronym using a title textbox on text change but i keep getting an error whenever i press space the error i get is
System.ArgumentOutOfRangeException: 'Index and length must refer to a location within the string. Parameter name: length'
this is what my form looks like: GUI
this is what my code looks like:
private void txtTitle_TextChanged(object sender, EventArgs e)
{
txtARC.Text = "";
if (!String.IsNullOrEmpty(txtTitle.Text))
{
string word = txtTitle.Text.ToString();
string[] wordArry = word.Split(' ');
for(int i=0; i<wordArry.Length; i++)
{
txtARC.Text = wordArry[i].Substring(0, 1);
}
}
}