473,396 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Binding a combobox to datasouce - code

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
{
}
}

}
Nov 15 '05 #1
2 1313
What is Codes? If it's a datatable or dataview, leave out the items...
"Jaco" <an*******@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
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
{
}
}

}

Nov 15 '05 #2
FYI

Id was a field and not a property. That was the problem

Thanks anyway for the help
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Omar | last post by:
When I try to databind my comboBox (specifically field "emplcode") to a filled dataset , the contents of the comboBox displays a bunch of "System.Data.DataRowView". I assume the amount of times...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
1
by: Bruce | last post by:
Hi, there, I meet a problem about comboBox binding. -------------------- Database: Northwind Tables: 1) Products 2) Categories I create a form (named "form1") to edit the record from...
0
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
3
by: amber | last post by:
Hello, I have 6 comboboxes, that I thought I could bind to the same datasource, and have them display different 'selectedvalue's', but apparently I can't... My code is as follows: dim drv as...
3
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
3
by: =?Utf-8?B?Sm9obiBCdW5keQ==?= | last post by:
New to databinding in vs2005, I always did it manually in 2003. I have no problem loading comboboxes, and a change in that combobox changes the data in the textboxes but I can not figure out a way...
1
by: Monty M. | last post by:
Does anyone know how to perform two way data binding between a combo box and a listview. The listview is bound to a dataset table in code: Binding Bind = new Binding(); DataTable dt;...
1
by: ray well | last post by:
i'm loading a combobox from a database in code, by setting the the DataSouce to a table, and the DisplayMember to a field. it loads the first row into the text area of the combobox automatically....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.