debugging designer errors

IfYouSaySo

Well-known member
Joined
Jan 4, 2006
Messages
102
Location
Hermosa Beach, CA
Programming Experience
3-5
How am I supposed to debug this?(!) No line numbers, no user code stack, nothing. Any suggestions? My usual method is to undo what I did last. The problem is that I opened my project and it wasn't working. I don't remember exactly what I did two days ago...

Value cannot be null. Parameter name: value
Hide

at System.Windows.Forms.WindowsFormsUtils.TypedControlCollection.Add(Control value)
at System.Windows.Forms.Design.ControlDesigner.DesignerControlCollection.Add(Control c)
 
It seems that something has become corrupted. What I usually do in this situation is create a new project and drag the offending form to it in the Solution Explorer. This will often regenerate corrupt files. Assuming that the form works in the new project I delete the original and drag the copy back again.
 
Ok so I've cracked open the MainFrame.Designer.vb and narrowed my problem down to the following line:

VB.NET:
Expand Collapse Copy
        '
        'TopToolStripPanel
        '
        Me.TopToolStripPanel.Controls.Add(Me.MainMenuStrip)

When I comment the line out, the code works. I thought maybe I wasn't newing the MainMenuStrip (not the problem) or that one of the ToolStripMenuItems in the Items.AddRange line (below) referenced a variable that was not new'ed:

VB.NET:
Expand Collapse Copy
        '
        'MainMenuStrip
        '
        Me.MainMenuStrip.Dock = System.Windows.Forms.DockStyle.None
        Me.MainMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.FileToolStripMenuItem, Me.EditToolStripMenuItem, Me.ViewToolStripMenuItem, Me.WindowToolStripMenuItem1, Me.HelpToolStripMenuItem})
        Me.MainMenuStrip.Location = New System.Drawing.Point(0, 0)
        Me.MainMenuStrip.MdiWindowListItem = Me.WindowToolStripMenuItem1
        Me.MainMenuStrip.Name = "MainMenuStrip"
        Me.MainMenuStrip.Size = New System.Drawing.Size(483, 24)
        Me.MainMenuStrip.TabIndex = 8
        Me.MainMenuStrip.Text = "MainMenuStrip"

So I tried commenting out the Me.MainMenuStrip.Items.AddRange() {...} line. No dice.

Any further ideas?
 
Aghhhhhhh!!!

Ok so I guess I renamed the MenuStrip1 to MainMenuStrip, and apparenty there's already a member mainmenustrip in the Form class...so rename fixes that. now I have a potentially bigger problem. I did a lot of screwing around in the .Designer.vb file, and I'm dealthly afraid that if I use the UI to modify anything in my form i'll lose half of my work. I know it says not to edit the .Designer file directly but I was desperate and now I'll pay an eternal price!!!!

AHHHHHHh!!!!!!!

Is there any escape besides redesigning the whole form from scratch...
 
Back
Top