Binding a combobox to datasouce - code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey,

I receive always following error :
{"Could not bind to the new value member.\r\nParameter name: value" }

I don't find the problem in my source. Can someone have a look to it.
I use the property "Omschrijving" for the displaymember and that is not a problem. Why I have a problem with the property Id? I also check the whole array and there are no null-values in Id.

tkx,
Jac

My code :
....
this.Cmb01.DataSource = Codes.Splitsingen.Items;
this.Cmb01.DisplayMember = "Omschrijving";
this.Cmb01.ValueMember = "Id";
....


In an other class :
public class Splitsingen
{
public static Splitsing Jaarlijks = new Splitsing (1,"1",1,12,"Jaarlijks","Annuel","Yearly");
public static Splitsing Halfjaarlijks = new Splitsing (2,"2",2,6,"Halfjaarlijks","Semestriel","6months");
public static Splitsing[] Items = new Splitsing[5]{Jaarlijks,Halfjaarlijks,Trimestrieel,Maandelijks,Eenmalig};
}
public class Splitsing : CodeX
{
public int AantalPeriodesPerJaar;
public int AantalMaandenPerPeriode;

internal Splitsing(int id, string code, int aantalPeriodesPerJaar, int aantalMaandenPerPeriode, string omschrijvingN, string omschrijvingF, string omschrijvingE) : base(id, code, omschrijvingN, omschrijvingF, omschrijvingE)
{
AantalPeriodesPerJaar = aantalPeriodesPerJaar;
AantalMaandenPerPeriode = aantalMaandenPerPeriode;
}
public Splitsing()
{
}

}
public abstract class CodeX
{
public int Id;

private string OmschrijvingN;
public string Code;

public CodeX()
{
}
internal CodeX(int id, string code, string omschrijvingN)
{
Id = id;
Code = code;
OmschrijvingN = omschrijvingN;
}
public string Omschrijving
{
get
{
if (OmgevingParameter.Taal == Talen.Ned)
{
return OmschrijvingN;
}
}
set
{
}
}

}
 
What is Codes? If it's a datatable or dataview, leave out the items...
Jaco said:
Hey,

I receive always following error :
{"Could not bind to the new value member.\r\nParameter name: value" }

I don't find the problem in my source. Can someone have a look to it.
I use the property "Omschrijving" for the displaymember and that is not a
problem. Why I have a problem with the property Id? I also check the whole
array and there are no null-values in Id.
tkx,
Jac

My code :
..
this.Cmb01.DataSource = Codes.Splitsingen.Items;
this.Cmb01.DisplayMember = "Omschrijving";
this.Cmb01.ValueMember = "Id";
..


In an other class :
public class Splitsingen
{
public static Splitsing Jaarlijks = new Splitsing (1,"1",1,12,"Jaarlijks","Annuel","Yearly");
public static Splitsing Halfjaarlijks = new Splitsing (2,"2",2,6,"Halfjaarlijks","Semestriel","6months");
public static Splitsing[] Items = new Splitsing[5]{Jaarlijks,Halfjaarlijks,Trimestrieel,Maandelijks,Eenmalig};
}
public class Splitsing : CodeX
{
public int AantalPeriodesPerJaar;
public int AantalMaandenPerPeriode;

internal Splitsing(int id, string code, int aantalPeriodesPerJaar, int
aantalMaandenPerPeriode, string omschrijvingN, string omschrijvingF, string
omschrijvingE) : base(id, code, omschrijvingN, omschrijvingF, omschrijvingE)
 
Back
Top