Still having problems with custom controls

G

graeme g

hi

my custom control doesn't seem to store data, i.e. when i change the
value in the designer, when i run it the value has gone back to the
default value.. here's is a code snippet

this class stores the information, it is referenced in 3 places in my
custom control

public class Sizes
{
private int width, height;

public int Width {get{return width;}set{width=value;}}
public int Height {get{return height;}set{height=value;}}

public Sizes(int width, int height)
{
this.width = width;
this.height = height;
}
}


and in my control this is the property and variable

private Sizes cellSize;
public Sizes CellSize {get{return cellSize;}set{cellSize = value;}}

and the constructor (which is where i think the problem lies) says

cellSize = new Sizes(30,30);


When i goto the designer and change the value of CellSize, the value is
there but after i compile and run it, the value is back to 30,30 and not
what i set in the designer....

what am i missing??? i only stored c# a lil while back i used to use
borland c++ builder - so you see where my problems lie...

thanks
graeme
 
G

graeme g

Oliver said:
graeme said:
and in my control this is the property and variable

private Sizes cellSize;
public Sizes CellSize {get{return cellSize;}set{cellSize = value;}}


Right in front of this last line, try putting

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]



Oliver Sturm
yay!!! thank yoo
 
O

Oliver Sturm

graeme said:
and in my control this is the property and variable

private Sizes cellSize;
public Sizes CellSize {get{return cellSize;}set{cellSize = value;}}

Right in front of this last line, try putting

[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]



Oliver Sturm
 

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