[英]How to pass data back from Winform to tabpage
if (!existed_channel.Contains(channel_name))
{
if (x)
{
tabpagex.BackColor = Color.Ivory;
tabControl1.TabPages.Add(tabpagex);
client_chat c = new client_chat(channel_name, owner); //Here the client_chat is my Winform that do all the chatting thing.
c.TopLevel = false;
c.Visible = true;
c.BackColor = Color.Ivory;
c.FormBorderStyle = FormBorderStyle.None;
c.Dock = DockStyle.Fill;
tabControl1.TabPages[tab_index].Controls.Add(c); //Here i fill up the tabpage with client_chat winform
tab_index++; //Increment the index everytime i add an tabpage.
existed_channel.Add(channel_name); //Add the name of the page to an arraylist, to make sure everytime there is no duplicate page
}
}
如您所见,当我关闭我的一个 Winform(在标签页上)时,我必须发回数据并修改 tab_index。 我可以关闭 Winform 和标签页,但很难将数据发回。 我知道如何将数据从 childForm 发送回 parentForm,但这里的情况有点不同。
您可以在所有控件都可以访问的父项上使用全局属性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.