WHAT I HAVE:
This application places labels in a richtextbox and the labels text is = to the last button and radio button clicked/selected on the forum.
List<string> placed_transpose_btn = new List<string>();
// Create Label at mouse click location with clicked chord's text.
private void SongSheet_Click(object sender, EventArgs e)
{
Point mouse = PointToClient(MousePosition);
SongSheet.SendToBack();
placed_transpose_btn.Add(Current_Cord_Lbl1 + Current_Cord_Lbl2);
this.Controls.Add(new Label
{
Location = new Point(mouse.X - 15, mouse.Y - 5),
AutoSize = true,
Text = Current_Cord_Lbl1 + Current_Cord_Lbl2,
BackColor = System.Drawing.Color.White,
ForeColor = System.Drawing.Color.Red,
});
// This is just to see the content of the list
SongSheet.Text = Convert.ToString(placed_transpose_btn);
}
OUTPUT:
System.Collections.Generic.List'1[System.String]
(Oh and labels only appear every 2nd click at last clicked location ... why is that?)
WHAT I NEED:
Someone posted a answer but deleted it again.
He/She said
SongSheet.Text = Convert.ToString(placed_transpose_btn);
Is trying to convert the entire string. I should instead use
SongSheet.Text = string.Join(Environment.NewLine, placed_transpose_btn);
That said it means i have been adding the Labels to a list all along i was just not accessing it properly.