Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 22nd, 2010 | Syntax: C# | Size: 0.85 KB | Hits: 71 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1.         private void changePanel(UserControl customControl)
  2.         {
  3.             try
  4.             {
  5.                 foreach (Control c in tableLayoutPanelMain.Controls.Cast<Control>().Where((c) => tableLayoutPanelMain.GetRow(c) == 1))
  6.                 {
  7.                     // Unload current control in panel
  8.                     tableLayoutPanelMain.Controls.Remove(c);
  9.  
  10.                     // Set customControl as content of panel
  11.                     tableLayoutPanelMain.Controls.Add(customControl);
  12.  
  13.                     // Set lableTitle
  14.                     labelTitle.Text = customControl.Name;
  15.  
  16.                     MessageBox.Show("Test");
  17.                 }
  18.  
  19.                 // Refresh TableLayoutPanelContainer
  20.                 tableLayoutPanelMain.Refresh();
  21.             }
  22.             catch (Exception e)
  23.             {
  24.  
  25.             }
  26.         }