Re: databindings

From: Dmitriy Lapshin [C# / .NET MVP] (x-code_at_no-spam-please.hotpop.com)
Date: 04/14/04


Date: Wed, 14 Apr 2004 10:11:19 +0300

Hi,

First of all, try to remove the "pictures." prefix from the DisplayMember
and the ValueMember initialization values. To the best of my knowledge, the
prefix is not necessary in your databinding scenario.

-- 
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"frazer" <ichor@hotmail.com> wrote in message
news:OEp70LbIEHA.3508@TK2MSFTNGP09.phx.gbl...
> hi i have the following code in my project
>
> ArrayList pictures = (new Pictures()).GetAllPictures();
> allPictures.DataSource = pictures;
> allPictures.DisplayMember = "pictures.ToString()";   //pictures.ToString
> returns the names of the pictures.
> allPictures.ValueMember  = "pictures.Bitmap";         //this returns the
> actual picture. and i get the foll error here
>
>
>
>   private void allPictures_SelectedValueChanged(object sender,
> System.EventArgs e)
>   {
>    if (allPictures.SelectedIndex != -1)
>     pictureBox.Image = (Image)allPictures.SelectedValue;  //this is used
to
> display the image in the picture box
>
>
>   }
>
>
>
>
>
> System.ArgumentException: Cannot create a child list for field pictures.
>    at System.Windows.Forms.BindingContext.EnsureListManager(Object
> dataSource, String dataMember)
>    at System.Windows.Forms.BindingContext.get_Item(Object dataSource,
String
> dataMember)
>    at System.Windows.Forms.ListControl.SetDataConnection(Object
> newDataSource, BindingMemberInfo newDisplayMember, Boolean force)
>    at System.Windows.Forms.ListControl.set_ValueMember(String value)
>    at TreeViewImages.Form1.Form1_Load(Object sender, EventArgs e) in
> form1.cs:line 314
>
>
> what am i doing wrong.
>
>


Relevant Pages

  • Re: difference
    ... Interesting question...the "di" prefix would certain suggest that such is the ... that the latter is nothing but a relict now....r ... Evelyn Wood just looks at the pictures. ...
    (alt.usage.english)
  • Re: How observant are you? (A quiz :)
    ... No picture came up -- just a blank page with some obvious foreign words at ... There are two identical pictures ... <?XML:NAMESPACE PREFIX = O ...
    (sci.med.transcription)
  • Re: databindings
    ... > returns the names of the pictures. ... In that datasource, objects are stored. ... DisplayMember you specify which property of THESE OBJECTS the control has ... and bind to that. ...
    (microsoft.public.dotnet.languages.csharp)
  • databindings
    ... ArrayList pictures = ).GetAllPictures; ... display the image in the picture box ... dataSource, String dataMember) ... at System.Windows.Forms.BindingContext.get_Item(Object dataSource, String ...
    (microsoft.public.dotnet.languages.csharp)

Quantcast