Jakob Lithner
2007-10-22 15:07:02 UTC
I have a usercontrol that I divide with a SplitContainer.
I set some specific positions and everything works fine.
The problem is that EVERY time I change anything in the control (code or
design) the designer moves around a couple of lines in the designer file
which means I get a runtime exception!
This is the section:
'
'mySplitContainer
'
Me.mySplitContainer.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top
Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right),
System.Windows.Forms.AnchorStyles)
Me.mySplitContainer.Location = New System.Drawing.Point(0, 0)
Me.mySplitContainer.Name = "mySplitContainer"
'
'mySplitContainer.Panel1
'
Me.mySplitContainer.Panel1.Controls.Add(Me.btnConfirmAll)
Me.mySplitContainer.Panel1.Controls.Add(Me.btnSkipTranslation)
Me.mySplitContainer.Panel1.Controls.Add(Me.lblTextCount)
Me.mySplitContainer.Panel1.Controls.Add(Me.btnConfirmEnglish)
Me.mySplitContainer.Panel1.Controls.Add(Me.lblTextSelectedCount)
Me.mySplitContainer.Panel1.Controls.Add(Me.btnFind)
Me.mySplitContainer.Panel1.Controls.Add(Me.grdText)
Me.mySplitContainer.Panel1.Controls.Add(Me.btnApproveNext)
Me.mySplitContainer.Panel1MinSize = 400
'
'mySplitContainer.Panel2
'
Me.mySplitContainer.Panel2.Controls.Add(Me.btnClose)
Me.mySplitContainer.Panel2.Controls.Add(Me.ctrlText)
Me.mySplitContainer.Panel2.Controls.Add(Me.grdTextRows)
Me.mySplitContainer.Panel2.Controls.Add(Me.btnSave)
Me.mySplitContainer.Panel2.Controls.Add(Me.btnAction)
Me.mySplitContainer.Panel2.Controls.Add(Me.lblTextRowCount)
Me.mySplitContainer.Panel2.Controls.Add(Me.btnCopyEnglish)
Me.mySplitContainer.Panel2MinSize = 369
Me.mySplitContainer.Size = New System.Drawing.Size(1020, 528)
Me.mySplitContainer.SplitterDistance = 490
Me.mySplitContainer.SplitterWidth = 8
Me.mySplitContainer.TabIndex = 0
Exception occurs on line (Me.mySplitContainer.Panel2MinSize = 369):
"SplitterDistance must be between Panel1MinSize and Width - Panel2MinSize"
At this time SplitterDistance has a value of 121.
In my mind all properties of the mySplitContainer should be set before all
properties of the sub panels. As you can see there are four properties of the
mySplitContainer that are moved to the end, AFTER all properties of the
Panel2!
When this happens I gently move the lines back where I think they should be
and quickly check in my code, compile, run and everything is fine.
But the next time I need to make and adjustment to this user control the
designer moves the same rows around again, and I get runtime error.
Any suggestions for this ghost behaviour?
I set some specific positions and everything works fine.
The problem is that EVERY time I change anything in the control (code or
design) the designer moves around a couple of lines in the designer file
which means I get a runtime exception!
This is the section:
'
'mySplitContainer
'
Me.mySplitContainer.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top
Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right),
System.Windows.Forms.AnchorStyles)
Me.mySplitContainer.Location = New System.Drawing.Point(0, 0)
Me.mySplitContainer.Name = "mySplitContainer"
'
'mySplitContainer.Panel1
'
Me.mySplitContainer.Panel1.Controls.Add(Me.btnConfirmAll)
Me.mySplitContainer.Panel1.Controls.Add(Me.btnSkipTranslation)
Me.mySplitContainer.Panel1.Controls.Add(Me.lblTextCount)
Me.mySplitContainer.Panel1.Controls.Add(Me.btnConfirmEnglish)
Me.mySplitContainer.Panel1.Controls.Add(Me.lblTextSelectedCount)
Me.mySplitContainer.Panel1.Controls.Add(Me.btnFind)
Me.mySplitContainer.Panel1.Controls.Add(Me.grdText)
Me.mySplitContainer.Panel1.Controls.Add(Me.btnApproveNext)
Me.mySplitContainer.Panel1MinSize = 400
'
'mySplitContainer.Panel2
'
Me.mySplitContainer.Panel2.Controls.Add(Me.btnClose)
Me.mySplitContainer.Panel2.Controls.Add(Me.ctrlText)
Me.mySplitContainer.Panel2.Controls.Add(Me.grdTextRows)
Me.mySplitContainer.Panel2.Controls.Add(Me.btnSave)
Me.mySplitContainer.Panel2.Controls.Add(Me.btnAction)
Me.mySplitContainer.Panel2.Controls.Add(Me.lblTextRowCount)
Me.mySplitContainer.Panel2.Controls.Add(Me.btnCopyEnglish)
Me.mySplitContainer.Panel2MinSize = 369
Me.mySplitContainer.Size = New System.Drawing.Size(1020, 528)
Me.mySplitContainer.SplitterDistance = 490
Me.mySplitContainer.SplitterWidth = 8
Me.mySplitContainer.TabIndex = 0
Exception occurs on line (Me.mySplitContainer.Panel2MinSize = 369):
"SplitterDistance must be between Panel1MinSize and Width - Panel2MinSize"
At this time SplitterDistance has a value of 121.
In my mind all properties of the mySplitContainer should be set before all
properties of the sub panels. As you can see there are four properties of the
mySplitContainer that are moved to the end, AFTER all properties of the
Panel2!
When this happens I gently move the lines back where I think they should be
and quickly check in my code, compile, run and everything is fine.
But the next time I need to make and adjustment to this user control the
designer moves the same rows around again, and I get runtime error.
Any suggestions for this ghost behaviour?