CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005
    Posts
    56

    Unhappy Any VS-2010 Gurus out there?

    I'm trying to build my first dot.net 4.0 program using VS-2010 and it ain't exactly like dot.net 1.1 which my former employer keep me working on. Things are going along great until I want to add another menu item to my main menu (now called a menuStrip). New trick - add it to the MainForm and then add it to the other windows forms (Child forms in the MDI) scheme) and replace it so you call the correct code where focus is on the child form.No problem except VS-2010 tries to outthink me.

    It keeps adding code for some strange reason. One thing it adds is another InitializeComponent() which seems to not only cause an ambiguous reference between the real method (In mumble.designer.cs) and this mini version VS-2010 adds to my code in mumble.cs. The worst thing is I now have a blank [design] for my form and my freaking menustrip (couple dozen items) has gone away along with other components. The program still works as the mumble.designer.cs page works after I remove the ambiguous InitializeComponent() but I'm going to have to hand edit every addition to the menustrip in that mumble.designer.cs (The one they say don't touch) or rebuild my whole form.

    Does anyone have an idea how to recover without wasting several hours?

  2. #2
    Join Date
    Jan 2010
    Posts
    1,133

    Re: Any VS-2010 Gurus out there?

    The old menu classes are still available.
    Anyway, the behavior you describe is rather strange. Did you manually code InitializeComponent() in MainForm.cs? Where does the IDE add the other method, in MainForm.Designer.cs?

    Also, I didn't quite understand what you mean by your "new trick". But, again, whatever you're doing, VS shouldn't be behaving that way...

  3. #3
    Join Date
    Jan 2005
    Posts
    56

    Unhappy Re: Any VS-2010 Gurus out there?

    No it coded it even though it had a perfectly good one in mumble.designer.cs and then it would use that to throw away my menuStrip1 I had laborously entered. Actually it did it twice - with a worksheet and an output sheet (both had FarPoint Spread Components as well). I tried to redo it a couple times and VS-2010 kept adding the second InitializeComponent() and undoing my work so after cursing (expletives deleted) Microsoft - I just gave up and did a work around.

    I cut everything from mumble.designer.cs and pasted it into my constructor region of mumble.cs.

    I Copied and Pasted my menuStrip from the MainForm to my two problem Windows Forms instead of retyping them and only changed the appropriate properties to replace, visable to false, etc.

    I re-added my FarPoint Components to my two Windows Forms Yet Another Time.

    I moved the start of the "region Windows Form Designer generated code" to include everything I had cut from the dang mumble.designer.cs pages (worksheet and output) so when collapsed I only have to see one stinking line and then erased everything else from the mumble.designer.cs pages (leaving the pages completely blank fools the IDE I guess into not creating a new mumble.desinger.cs file) and moved on with my programming task.

    As we would say in my day "Heck of a way to run a railroad!"

    Sorry bout saying "new Trick" - menuStrips don't seem to obey mergeIndex property (as well they did back in dotnet 1.1) as I wanted so I do a complete menu in my mainform which I layout and design before beginning a project and then make what I don't want visable when focus is on a form and use replace. That was my work-around - When I have time - I'll figure it out but what I'm doing works. As best as I can determine MergeIndex DOES NOT WORK in vs-2010.
    Last edited by K7SN; April 27th, 2012 at 08:00 PM. Reason: MergeIndex DOES NOT WORK in vs-2010

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured