AndyMills

Hi All

I'm creating a Wizard for an application to be used on Windows Mobile 5.0. The wizard uses a generic model where the individual steps are separate User Controls, and the Wizard itself is another UserControl with a panel to contain the current step, and Next/Previous buttons. I seem to be having trouble with the public theWizard() methods. The error is get is:

Error 1 Inconsistent accessibility: parameter type 'System.Collections.Generic.List' is less accessible than method 'SparkSmart_Mobile.theWizard.theWizard(System.Collections.Generic.List)' C:\Users\Andy\Documents\Visual Studio 2005\Projects\SparkSmart Suite\SparkSmart Mobile\SparkSmart Mobile\theWizard.cs 16 16 SparkSmart Mobile

The Code for theWizard.cs is as follows:

Code Snippet

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Drawing;

using System.Data;

using System.Text;

using System.Windows.Forms;

namespace SparkSmart_Mobile

{

public partial class theWizard : UserControl

{

private int currentStep;

private int totalSteps;

private List<wizardItem> steps;

public theWizard(List<wizardItem> steps)

{

InitializeComponent();

if (steps.Count > 0)

{

this.steps = steps;

totalSteps = steps.Count;

currentStep = 1;

ShowStep();

}

}

private void ShowStep()

{

cmdPrev.Visible = (currentStep != 1);

if (currentStep == totalSteps)

{

cmdNext.Text = "Finish";

}

else

{

cmdNext.Text = "Next";

}

stepTitle.Text = steps[currentStep - 1].stepTitle;

if (state != null && state[currentStep - 1] != null)

{

steps[currentStep - 1].ApplyValues(state[currentStep - 1]);

}

stepPanel.Controls.Clear();

UserControl ctrl = (UserControl)steps[currentStep - 1];

stepPanel.Controls.Add(ctrl);

}

private void cmdPrev_Click(object sender, EventArgs e)

{

currentStep--;

ShowStep();

}

private void cmdNext_Click(object sender, EventArgs e)

{

if (currentStep == totalSteps)

{

state = new Dictionary<string, string>[totalSteps];

for (int i = 0; i < totalSteps; i++)

{

state[i] = steps[i].GetValues();

}

}

else

{

currentStep++;

ShowStep();

}

}

private Dictionary<string, string>[] state;

public Dictionary<string, string>[] State

{

get

{

return state;

}

}

public theWizard(List<wizardItem> steps, Dictionary<string, string>[] state)

: this(steps)

{

this.state = state;

}

}

}

Could anyone help me please ! Thanks!




Re: Visual C# Language Problem with Wizard Model

Peter Ritchie

You haven't supplied all the code referenced by the error, so some of the details will be assumptions. But, that message is telling you that you've defined a public method theWizard for any other application to see, but the type List is not publicly availble for any other application to see. With List, this means the parameter type you've given it wizardItem) was not declared with public (it's some form of private, protected, or internal). Which means, despite being public, no other application can call theWizard. C# considers this an error.