C# Form accessing anonymous objects

Viewed 41

I'm throwing the objects that I created with the usercontrol to the flowlayoutPanel as much as the number of data in my database, I want to reach the texts of the selected object when I press and select it.

public void getProduct(string type)
    {

        flowLayoutPanel1.Controls.Clear();
        ServerControl cs = new ServerControl();
        var result = cs.TakeInfo(type);

        for (int i = 0; i < cs.count; i++)
        {
            var tutucu = new UserControl1();
            tutucu.nametag = result[i].Name;
            tutucu.pricetag = result[i].Price;
            tutucu.pathtag = result[i].Path;
            flowLayoutPanel1.Controls.Add(tutucu);
        }

    }

enter image description here

0 Answers
Related