Well i im trying to make a panel add a label with a that's text is +1 of the previous (starting from zero) each time enter is pressed in a rich Text Box, using the keyUp event but for some reason it only works in the first time I press enter and after that nothing happens, here the code i got so far:
Any ideas on how to many it work are appreciated.Code:private void richTextBox1_KeyUp(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { int number = int.Parse(labelK.Text); if (number != 0) { number++; int Ypoint = number * 13; int Y = 13 + Ypoint; Label label = new Label(); label.Name = "label" + number.ToString(); label.Location = new Point(3, Y); label.Text = number.ToString(); panel1.Controls.Add(label); } else { number++; Label label = new Label(); label.Name = "label" + number.ToString(); label.Location = new Point(3, 13); label.Text = number.ToString(); panel1.Controls.Add(label); } } }




Reply With Quote