Hello Everyone,
I have the below code within a C# Visual Studio Winforms application.
The issue I am having is on the buttonNext_Click event. In this event,
a UserControl from another project (Unit1) within the solution should
be dislayed within the form's panelRight object. This is working just
fine when the new UserControl is Added to the panel. However, I am
not able to understand why the previously loaded UserControl will not
be removed. My attempt to do so is located within the IF statement
found within the SWITCH.
Thank you in advance for your assistance.
namespace Platinum
{
static class BusinessUnits
{
static private int myBusinessUnit;
static public int BusinessUnit
{
get { return myBusinessUnit; }
set { myBusinessUnit = value; }
}
public enum Division
{
None = 0,
Unit1 = 1,
Unit2 = 2
//Business_Future1 = 4,
//Business_Future2 = 8,
//Business_Future3 = 16
}
}
}
namespace Platinum
{
private UserControl_Default myUserControl_Default = new
UserControl_Default();
private static int myCurrentWizardStep = 0;
protected override void buttonNext_Click(object sender, EventArgs e)
{
// Remove the default UserControl loaded if it is contained
within
this form.
if
(base.panelRight.Controls.Contains(this.myUserControl_Default))
{
base.panelRight.Controls.Remove(this.myUserControl_Default);
}
switch (Platinum.BusinessUnits.BusinessUnit)
{
case (int)BusinessUnits.Division.Unit1:
// Add the next UserControl within the wizard
to be displayed to
the user.
base.panelRight.Controls.Add(Unit1.Wizard.Steps[myCurrentWizardStep]);
// Remove the current UserControl loaded within
this form.
if (myCurrentWizardStep >= 0)
{
base.panelRight.Controls.Remove(Unit1.Wizard.Steps[myCurrentWizardStep]);
}
break;
}
myCurrentWizardStep++;
base.buttonNext_Click(sender, e);
}
}
namespace Unit1
{
public static class Wizard
{
/// <summary>
/// Returns the number of steps found within this wizard based
upon
the number of elements found
/// </summary>
public static int NumberOfSteps
{
get
{
return Steps.Length;
}
}
public static System.Windows.Forms.UserControl[] Steps
{
get
{
return new UserControl[]
{
new Intro(),
new Step1_UC1(),
new Step2_UC2(),
new Step3_UC3()
};
}
}
}
}
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net