Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a question related to the error on the title. Im working with c# and Visual Studio 2010.

I have a form declared as "public class FormularioGeneral : Form", which is the base for the rest of the forms in my application. When i try to access the Designer View i get this error several times, as you can see in the image:

Sample of errors All the errors references lines inside the InitializeComponent method, where the value is assigned to a property like this one:

[...]            
this.PanelMargenIzquierdoCapaBase.BackColor = m_ColorCapaBase;
[...]

But all the variables are declared in the same class as read-only properties and all of them are assigned inside a method which is called in the constructor.

Declaration of properties:

    protected Color m_VariableName;
    public Color VariableName
    {
        get { return m_VariableName; }
        set { }
    }

Constructor code:

    public FormularioGeneral()
    {
        ConfigurarUI();
        AccionesConstructor();
        InitializeComponent();
        PostInicializacionComponentes();
        EstablecerIcono();
        InicializarLocalizacionFormulario();
    }

ConfigurarUI method:

public virtual void ConfigurarUI()
{
        [...]

        m_AltoBordeSuperiorCapaBase = 30;
        m_AltoBordeInferiorCapaBase = 7;
        m_AnchoBordesLateralesCapaBase = 7;

        m_ColorCapaBase = Color.FromArgb(50, 100, 150);
        m_ColorTextoCapaBase = Color.White;
        m_ColorTextoBotonAplicacion = Color.Black;

        m_FuenteTextoIzquierdoCapaBase = new System.Drawing.Font("Verdana", 11.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        m_FuenteTextoCentroCapaBase = new System.Drawing.Font("Verdana", 14.0F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        [...]
}

So, as far as i know, all the variable which are giving the errors are correctly declared and have a value assigned before the InitilizeComponent function is called.

Im stuck at this point and dont know what to do to solve the problem. Hope some of you can help me with this issue.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
534 views
Welcome To Ask or Share your Answers For Others

1 Answer

So, I have had the same problem in the past, for fix I did the following:

  • Solution → Clean Solution;
  • Build → Rebuild Solution;
  • Close Visual Studio, re-open.

Thanks a lot to Marshall Belew!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...