Advertisement
Advertisement
| 07.04.2008 at 10:31PM PDT, ID: 23540351 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: |
this is what i have so far and needs cleanup.
#region "TabHandling"
public void HandleTabs(TabPage tabName, int selectedTab, bool Add, bool Remove, bool OnLoad)
{
if (OnLoad) // First enter the application
{
lblMsg.Text = "Initialization successful.";
this.MainTabControl.TabPages.Remove(CreateUpdatePriceListTab); // Update invisible until a row is selected or create button is clicked.
this.MainTabControl.TabPages.Remove(ErrorWarningsTab); // Error/Warning invisible until Load is completed.
this.MainTabControl.TabPages.Remove(CompareResultsTab); // Compare invisible until compare button is pressed.
}
if (Add)
{
lblMsg.Text = "Add Tab.";
this.MainTabControl.TabPages.Add(tabName);
if (tabName == CreateUpdatePriceListTab)
this.MainTabControl.SelectTab(selectedTab);
if (tabName == ErrorWarningsTab)
this.MainTabControl.SelectTab(selectedTab + 1);
if (tabName == CompareResultsTab)
this.MainTabControl.SelectTab(selectedTab + 2);
this.btnCreate.Visible = false;
}
if (Remove)
{
lblMsg.Text = "Remove Tab.";
this.MainTabControl.TabPages.Remove(tabName);
this.MainTabControl.SelectTab(selectedTab);
}
}
private void TabsChanged()
{
switch (MainTabControl.SelectedIndex)
{
case 0:
{
this.MainTabControl.TabPages.Remove(CreateUpdatePriceListTab); // Update invisible until a row is selected or create button is clicked.
this.btnCreate.Visible = true;
lblMsg.Text = "Create/Update a new price list.";
break;
}
// case 1:
// {
// this.btnCreate.Visible = false;
// this.btnLoad.Enabled = false;
// break;
// }
}
lblMsg.Text = "";
}
private void MainTabControl_SelectedIndexChanged(object sender, EventArgs e)
{
switch (MainTabControl.SelectedIndex)
{
case 0: // means we have a select tab
{
lblMsg.Text = "";
HandleTabs(CreateUpdatePriceListTab, MainTabControl.SelectedIndex, false, true, false);
btnCreate.Visible = true;
break;
}
case 1:
{
lblMsg.Text = "";
this.btnCreate.Visible = false;
this.btnLoad.Enabled = false;
break;
}
}
}
#endregion
|