简体   繁体   中英

Display data in textbox dynamically in Winform usercontrol

I have a UserControl in Winform, which has textbox1 . I have a separate controller class where the code execution happens.

Here is the controller class code:

foreach(DataRow Dtrw in DataTabl1.Rows)
{
    Usercontrol1 Uc = new Usercontrol();
    Uc.Textbox1.text = Dtrw["Col1"].ToString().Trim();
}

But this is not working, as textbox1 is not accessible. Is there any other way I can implement it?

On the textBox1 control Modifiers you can set it to public

修饰符

So it becomes accessible elsewhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM