I have dynamically created an array of labels. however, when i tried to set label.text = "hahaha hehehehe hmmmm", it displays only "hahaha" and not anything after the space.
for (int i = 0; i < labelArray.Length; i++)
{
labelArray[i] = new Label();
labelArray[i].BackColor = Color.Bisque;
labelArray[i].Font = new Font(labelArray[i].Font.FontFamily, labelArray[i].Font.Size + 5, FontStyle.Bold);
labelArray[i].Location = new Point(25, temp);
labelArray[i].Name = "searchLabel" + i.ToString();
labelArray[i].Text = "hahahahaha";
labelArray[i].MouseEnter += new EventHandler(main_MouseEnter);
labelArray[i].MouseLeave += new EventHandler(main_MouseLeave);
searchPanel.Controls.Add(labelArray[i]);
temp += 40; ;
}
have I missed out any anything? btw, this is the "initialization" done in Form_load and I edited the label.text in a TextChanged event. many thanks!
edit: I have since fixed the problem by setting autosize to true.
I have tried to display e.g. "hahahahahahahahaha hmmmmmm hehehehehehehehhe" and "ha hmmmmmmm hehehehehehhe" and in both cases only the first word gets displayed so I dont think it is being truncated..
the code which i used to set the text is simply:
labelArray[11].Text = "hahahahahahahahahaha eheheheheh hmmmmm";
hahahaha, you cannot dohehehe. Its not good for health :P