开发者

DatagridView doesn't show any data when I run my project

I created a UserControl for my project and I put a DataGridView inside this control. I chose a DataSource for this DataGridView from my database.

But when I bring this UserControl to my main form and run the project, it doesn't show any data from my database.

When I directly create DataGridView inside my main form, it works.

I need开发者_JAVA技巧 to do this by using UserControl.


When you use the IDE you are just providing the template (and other configuration metadata); you must still provide the actual data-source at runtime, for example by populating an object model or DataTable and assigning that as the DataSource of either the DataGridView or (more commonly when using the IDE) the BindingSource object that the designer added.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜