Ask a questionAsk a question
 

Answerdynamicly created tabcontrols and tabpages problem

  • Wednesday, November 04, 2009 2:51 PMnuri süral Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello,

    I am new with c#, but i developed myself (I believe) quick. But now i am stuck with my problem. Please if you can help me, i will be preciate so much.

    1- I created dynamicly a tabcontrol(tabcontrol1)

    2- I added dynamicly tabpages to my tabcontrol (Tabpage names All Inclusive, Half Board)

    3- I dynamicly created another tabcontrol (tabcontrol2) and tabpages (names date1, date2, date3) and i added second tabcontrol to the first tabcontrol.selectedtab

    4- I dynamicly added combobox (name newcombo) to second tabcontrols.tabpages. And i created again dynamicly Valuechange event.

    5- Problem is starting here. I can not reach second tabcontrol's selectedtab from dynamicly created valuechange event.

    Please help me, thanks in advance,

Answers

  • Wednesday, November 04, 2009 3:14 PMjgalley Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    not sure I follow, but does this get you want you want?

    (TabPage)(((ComboBox)sender).Parent)
  • Thursday, November 05, 2009 10:28 AMnuri süral Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    i found out the answer with mr. seser's brilliant help.

    its something like this

    combobox_itemsvaluechanged(object sender, EventArgs e)
    {
      ComboBox cb = sender as ComboBox;
      if (cb == null) return;
      TabPage tp = cb.Parent as TabPage;
      if (tp = null) return;
      TabControl tc = tp.Parent as TabControl;
      if (tc == null) return;
    }

    many thanx to everybody.

All Replies

  • Wednesday, November 04, 2009 3:14 PMjgalley Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    not sure I follow, but does this get you want you want?

    (TabPage)(((ComboBox)sender).Parent)
  • Thursday, November 05, 2009 10:28 AMnuri süral Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    i found out the answer with mr. seser's brilliant help.

    its something like this

    combobox_itemsvaluechanged(object sender, EventArgs e)
    {
      ComboBox cb = sender as ComboBox;
      if (cb == null) return;
      TabPage tp = cb.Parent as TabPage;
      if (tp = null) return;
      TabControl tc = tp.Parent as TabControl;
      if (tc == null) return;
    }

    many thanx to everybody.