User control and data binding in C # win applications

Suppose I have a user control in a win application and it has few controls, for example:

  • Employee Name - Text Box
  • Employee Age - Text Box
  • Employee sex combo
  • etc...

Now I want to design a common user control in such a way that when I assign something like usercontrolInstance.Databind=mydataset, then the whole control will be filled with data.

If I can develop that way, then the code will be reused and the approach will be professional.
I have no idea how I can design user control so that there is a property called datasource, and when I assign my data set to this property, then all the text fields in the user element will be filled with data ......

I beg you, please. Thank.

+3
source share

Source: https://habr.com/ru/post/1788573/


All Articles