adding a control to tabs generated dynamically in tabcontrol in C# .net

萝らか妹 提交于 2019-12-05 20:42:11
Srikanth V M

Please refer the below link! You will get more detail in this regard.

Creating a tab control with a dynamic number of tabs in Visual Studio C#

I'm not sure I completely understand your problem but my initial thoughts are that you could dynamically create a datagrid or something similar for each tab that you are dynmically creating. You could then bind the datasource for the grid and then add the grid as a control to your tabpage.

Something like...

DataGridView gv = new DataGridView();
gv.DataSource = //whatever your source is            
this.tabPage1.Controls.Add(gv);

You would then have all the events associated with the grid to work with.

I'm thinking data binding is going to be your best bet for displaying this information. You can create a list of objects and use a DataTemplate to format the data. You can apply the DataTemplate to a quite a few objects. I generally use the ItemsControl and ListBox

http://msdn.microsoft.com/en-us/library/ms750612.aspx

good luck

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!