L
Lucas Sain
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(DesignerSerializationVisibility.Content),
Editor(typeof(System.ComponentModel.Design.CollectionEditor),
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
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(DesignerSerializationVisibility.Content),
Editor(typeof(System.ComponentModel.Design.CollectionEditor),
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