Heeelp please, using enumerator in Property but its not getting saved...

L

Lucas Sain

Hi,
I'm using an enumerator to store some options so that at design time X
options could be selected. All this works fine until the developer closes
the FORM where the property is and re-opens it.l.. the values are reset.
Why??? This is what I have:

public class LidColumnCollection : CollectionBase
{
public LidColumnCollection()
{
}
public int Add(LidColumnItem Item)
{
return List.Add(Item);
}
public LidColumnItem this[int Index]
{
get
{
return List[Index] as LidColumnItem;
}
set
{
List[Index] = value;
}
}
}


public class LidColumnItem : Component
{
private string nombreColumnaBaseDatos;
private string nombreADeplegar;
private LidEnumTipoCampo tipoCampo;
public enum LidEnumTipoCampo {String,Date,Numeric};
//Constructor
public LidColumnItem()
{
}
[Description("Column Name")]
public string NombreColumnaBaseDatos
{
get {return nombreColumnaBaseDatos;}
set {nombreColumnaBaseDatos = value;}
}
[Description("Display Name")]
public string NombreADeplegar
{
get {return nombreADeplegar;}
set {nombreADeplegar = value;}
}

[
Description("Type of Data.")
]
public LidEnumTipoCampo TipoCampo
{
get
{
return this.tipoCampo;
}
set
{
this.tipoCampo = value;
}
}
}

NOTE: this is the Property on a Form that is inherited afterwards using
visual inhertiance. This is the property that is manipulated in design time

private LidColumnCollection lidColumnasAMostrar = null;
[

DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Editor(typeof(System.ComponentModel.Design.CollectionEditor),
typeof(System.Drawing.Design.UITypeEditor)),
Description("A Collection od strings a data type that will be placed on
the GridList"),
ToolboxItem(false)
]
public LidColumnCollection LidColumnasAMostrar
{
set
{
lidColumnasAMostrar = value;
}
get
{
if(lidColumnasAMostrar == null)
{
lidColumnasAMostrar = new LidColumnCollection();
}
return lidColumnasAMostrar;
}
}


Help is really appreciated
Lucas
 
F

Fergus Cooney

Hi Lucas,

I believe Form closed = Form bye, bye.

Which means that you'll have to persist the values between
invocations.

Regards,
Fergus
 
L

Lucas Sain

Fergus

I thught I was peristing the code using the attribute:
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)

Unless I'm missing something...

Regards
Lucas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top