Re: databindings
From: Dmitriy Lapshin [C# / .NET MVP] (x-code_at_no-spam-please.hotpop.com)
Date: 04/14/04
- Next message: Vijaye Raji: "Re: Help w/ choosing a control type"
- Previous message: Vijaye Raji: "Re: int to byte[]"
- In reply to: frazer: "databindings"
- Next in thread: Frans Bouma [C# MVP]: "Re: databindings"
- Messages sorted by: [ date ] [ thread ]
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. > >
- Next message: Vijaye Raji: "Re: Help w/ choosing a control type"
- Previous message: Vijaye Raji: "Re: int to byte[]"
- In reply to: frazer: "databindings"
- Next in thread: Frans Bouma [C# MVP]: "Re: databindings"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|