Answer the question
In order to leave comments, you need to log in
How to create an object in WinForms and hang a handler?
How to create an object in a loop using WinForms?
The program receives a string from the site and splits it by the delimiter, so an "array" of contacts is formed.
You need to create a "Label" object and attach a click handler to it.
Are there good examples?
Answer the question
In order to leave comments, you need to log in
int y = startY;
this.SuspendLayout();
foreach(var contact in GetContactsFromSite())
{
Label lbl = new Label();
lbl.Text = contact.Name;
lbl.Location = new Point(startX,y);
y += lbl.Height + 4;
lbl.Click += (s,e) => { /*some handler */ };
this.Controls.Add(lbl);
}
this.ResumeLayout();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question