Child list for field owner-info cannot be created

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

Guest

My name is Norm, I changed something that caused this problem, and I do not
what it was. I also do not know how to debug this problem! The line where
the crash occures is marked by an *. The windows form will not display in the
designer.
Please help!!

//
// Animal
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(822, 554);
this.Controls.Add(this.label10);
this.Controls.Add(this.groupbox3);
this.Controls.Add(this.groupBox1);
* this.Font = new System.Drawing.Font("Times New Roman", 8.25F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Menu = this.mainMenu1;
this.Name = "Animal";
this.Text = "Animal Information";
this.Load += new System.EventHandler(this.Animal_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupbox3.ResumeLayout(false);
this.groupbox3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dsAnimal1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.grdShots)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.grdHistory)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.grdMedications)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pcAnimalPhoto)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
 
Well, what does the error message say (in the IDE)???

And also: source control! show diffs...

The designer is notorious for being a bit sensitive.
Since it is just a font line, I would be inclined to just remove it
completely and see if it resolves itself after a rebuild. If so, just
change the font again from the designer and hope. If it doesn't help,
then I tend to cut chunks large chunks until I find what broke
(observing dependencies...) - a kind of manual binary search.

Also - note that the flakey designer can sometimes just get grumpy.
Close the IDE completely and reload your project. You'd be /amazed/ how
often this helps. It gets even flakier with data bindings [hence I
never trust the IDE to do them!]

;-p

Marc
 
The error messages:

System.ArgumentException: Child list for field owner-info cannot be created.
at System.Windows.Forms.BindingContext.EnsureListManager(Object
dataSource, String dataMember)
at System.Windows.Forms.BindingContext.UpdateBinding(BindingContext
newBindingContext, Binding binding)
at System.Windows.Forms.Control.UpdateBindings()
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)
at System.Windows.Forms.Control.set_BindingContextInternal(BindingContext
value)
at
System.Windows.Forms.ContainerControl.set_BindingContext(BindingContext value)
at System.Windows.Forms.ContainerControl.get_BindingContext()
at System.Windows.Forms.Control.get_BindingContextInternal()
at System.Windows.Forms.Control.get_BindingContext()
at System.Windows.Forms.Control.get_BindingContextInternal()
at System.Windows.Forms.Control.get_BindingContext()
at System.Windows.Forms.DataGrid.get_ListManager()
at System.Windows.Forms.DataGrid.RecreateDataGridRows()
at System.Windows.Forms.DataGrid.OnFontChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentFontChanged(EventArgs e)
at System.Windows.Forms.Control.OnFontChanged(EventArgs e)
at System.Windows.Forms.GroupBox.OnFontChanged(EventArgs e)
at System.Windows.Forms.Control.OnParentFontChanged(EventArgs e)
at System.Windows.Forms.Control.OnFontChanged(EventArgs e)
at System.Windows.Forms.ContainerControl.OnFontChanged(EventArgs e)
at System.Windows.Forms.Form.OnFontChanged(EventArgs e)
at System.Windows.Forms.Control.set_Font(Font value)
at Owner_Info.Animal.InitializeComponent() in
D:\Kennel\Owner-Info\Animal.cs:line 1602
at Owner_Info.Animal..ctor(String onum, Int32 oclose, Int32 sw3) in
D:\Kennel\Owner-Info\Animal.cs:line 126
at Owner_Info.Owner.btAinfo_Click(Object sender, EventArgs e) in
D:\Kennel\Owner-Info\Owner.cs:line 1765
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
 
See! I told you it can get freaked with bindings!
at System.Windows.Forms.BindingContext.EnsureListManager(Object
dataSource, String dataMember)
at System.Windows.Forms.BindingContext.UpdateBinding(BindingContext
newBindingContext, Binding binding)
at System.Windows.Forms.Control.UpdateBindings()
at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)

Of course, that doesn't help you much...
If all else fails, you could move the Font assignment outside of
InitializeComponent, and into the start of the ctor. It might mean that
it doesn't show in the designer, but it should work at runtime.

As another word of warning... bindings in the designer work OK for some
people, but personally I've lost too many hours trying to unpick
binding code that the designer has garbled. I might use the designer as
a short-cut for creating bindings, but as routine I now *immediately*
snip them from InitializeComponent and place them in a private method
that I call manually in the ctor. Again, you don't see much at design
time, but this is not my main aim; having a project that doesn't commit
suicide every second Tuesday is far preferable. Your mileage may vary,
and if you want to continue keeping your bindings in
InitializeComponent, then good luck to you (you might just need it). As
a side benefit it can give you more control and flexibility over your
bindings too.

I know of others who prefer to do *all* their UI coding by hand.
Personally I mix and match per situation. I do, however, keep designer
forms simple. If I find it is getting a bit full, I'll carve chunks
(tab pages or busy panels, for instance) into separate user controls;
this minimises the impact if (when) the designer hiccoughs - and
usually you can just fix the designer problem by loading the embedded
user-control at runtime manually instead of in InitializeComponent.

Marc
 
Back
Top