Connecting Tech Pros Worldwide Help | Site Map

how to create a property with drop options???

Lucas Sain
Guest
 
Posts: n/a
#1: Nov 15 '05
Hi,

I'm trying to create a property in a class that should be apepar as
dropdown combo at design time with X options. Something like the
WindowStateProperty where you can select 3 options. How can this be done
I've tried several ways but can't get it to work. Whta am I doing wrong?.
This is what I have in the class

private ComboBox fieldType= new ComboBox();
private DataTable dtFieldType;
loadCombo();
[
DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content),
Editor(typeof(System.ComponentModel.Design.Collect ionEditor),
typeof(System.Drawing.Design.UITypeEditor)),
Description("Type you want to display")
]
public ComboBox FieldType
{
get
{
return dtFieldType;
}
set
{
dtFieldType= value;
}
}

private LoadCombo()
{
this.dtFieldType= new DataTable();
this.dtFieldType.Columns.Add("Type");
//============================================
DataRow drFieldType = dtFieldType.NewRow();
drFieldType ["Type"] = "String";
dtFieldType.Rows.Add(drFieldType);
//============================================
drFieldType = dtFieldType.NewRow();
drFieldType ["Type"] = "Date";
this.dtFieldType.Rows.Add(drFieldType);
//============================================
drFieldType = dtFieldType.NewRow();
drFieldType ["Type"] = "Numeric";
this.dtFieldType.Rows.Add(drFieldType);
//===
tipoCampo.DataSource = this.dtFieldType;
tipoCampo.DisplayMember = "Type";
tipoCampo.ValueMember = "Type";
}


The combo does show up in Design time but no options are present.

Help is really appreciated
Lucas



Lucas Sain
Guest
 
Posts: n/a
#2: Nov 15 '05

re: how to create a property with drop options???


I got it to work. I forgot about enumerators and they did the trick.
Oooppsss

Regards
Lucas

"Lucas Sain" <lsain@lidersoft.com> wrote in message
news:uUBSGmXbDHA.1272@TK2MSFTNGP12.phx.gbl...[color=blue]
> Hi,
>
> I'm trying to create a property in a class that should be apepar as
> dropdown combo at design time with X options. Something like the
> WindowStateProperty where you can select 3 options. How can this be done
> I've tried several ways but can't get it to work. Whta am I doing wrong?.
> This is what I have in the class
>
> private ComboBox fieldType= new ComboBox();
> private DataTable dtFieldType;
> loadCombo();
> [
>[/color]
DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content),[color=blue]
> Editor(typeof(System.ComponentModel.Design.Collect ionEditor),
> typeof(System.Drawing.Design.UITypeEditor)),
> Description("Type you want to display")
> ]
> public ComboBox FieldType
> {
> get
> {
> return dtFieldType;
> }
> set
> {
> dtFieldType= value;
> }
> }
>
> private LoadCombo()
> {
> this.dtFieldType= new DataTable();
> this.dtFieldType.Columns.Add("Type");
> //============================================
> DataRow drFieldType = dtFieldType.NewRow();
> drFieldType ["Type"] = "String";
> dtFieldType.Rows.Add(drFieldType);
> //============================================
> drFieldType = dtFieldType.NewRow();
> drFieldType ["Type"] = "Date";
> this.dtFieldType.Rows.Add(drFieldType);
> //============================================
> drFieldType = dtFieldType.NewRow();
> drFieldType ["Type"] = "Numeric";
> this.dtFieldType.Rows.Add(drFieldType);
> //===
> tipoCampo.DataSource = this.dtFieldType;
> tipoCampo.DisplayMember = "Type";
> tipoCampo.ValueMember = "Type";
> }
>
>
> The combo does show up in Design time but no options are present.
>
> Help is really appreciated
> Lucas
>
>
>[/color]


Closed Thread