Solved

Form designer problem

Posted on 2006-11-16
12
193 Views
Last Modified: 2008-02-01
I have a problem with a form that I have deigned and otherwise works fine. I have an application to which I have added a number of forms. When I double-click on any of the FormName.vb files in Solution Explorer, it displays the selected form in design mode except for my "problem" form. When I double-click on it the code form is displayed yet when I run the app and hit the button that opens the form it displays fine. I thought maybe the file had been corrupted so dleted the old form and rebuilt the form from scratch. It opened fine in design view until I ran the app once now the old behavior is back There has to be something simple that I am missing here.
0
Comment
Question by:tmostad
12 Comments
 
LVL 16

Expert Comment

by:Hillwaaa
ID: 17960951
Hi tmostad,

In the solution explorer, can you right-click and select View Designer, or is that option not available?

In the past, I have had this issue where something in the auto generated section of the form (the "Windows Form Designer generated code" section) was invalid / incorrect.  My guess would be that your form has some setting that is set at run time which allows it to display fine when you ran it, but not from VS.

Also, does the class have "Inherits System.Windows.Forms.Form"?

Anyone else have any ideas?
0
 
LVL 1

Author Comment

by:tmostad
ID: 17961091
The "View Designer" menu option in not available but only for that form.

I looked in the "Windows Form Designer generated code" section and there are no apparent errors.

Lastly the "Inherits System.Windows.Forms.Form" is there.
0
 
LVL 16

Expert Comment

by:Hillwaaa
ID: 17961224
Hmm, in that case there is something that is causing VS to think that the form is not a form - can you post the code for that form?
0
 
LVL 1

Author Comment

by:tmostad
ID: 17961252
There is exactly one line of code for one button (OK button) on the form:

Me.Close()

I could even manage to get it wrong I suppose but it works so I am still no closer to a solution but thanks for the ideas.
0
 
LVL 16

Expert Comment

by:Hillwaaa
ID: 17961281
One other thing to try - does closing and opening the solution fix the problem? (File->close solution)

I managed to replicate the problem by commenting out the inherits windows form line and saving it.  After uncommenting the line and re-saving it, the form in the solution explorer didn't become usable as a form until I closed the solution or rebuilt it (Build -> rebuild solution)

Let me know if either works.
0
 
LVL 1

Author Comment

by:tmostad
ID: 17961371
I tried every permutation you suggest and a few more like trying to build with the inherits line commented out which then of course errored. I then uncommented the line and did a rebuild, no change.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:tmostad
ID: 17961394
BTW - I searched the web and found a similar problem description but for C#. They suggested editing the .csproj file to add a SubType form at the right location for the problematic form where "right" can be determined by looking at the definitions for other forms. I did this but there was no change.
0
 
LVL 1

Author Comment

by:tmostad
ID: 17961472
Of course I meant I edited the .vbproj file...
0
 
LVL 39

Expert Comment

by:appari
ID: 17962305

if possible can you upload the problem form to http://www.ee-stuff.com
0
 
LVL 7

Accepted Solution

by:
dctuck earned 500 total points
ID: 17964172
I had this problem before, and the reason was that I had declared another class at the top of the code file for the form. The Class for the form itself needs to be at the top for VS to recognise it within the IDE as a proper form
0
 
LVL 1

Author Comment

by:tmostad
ID: 17966805
I discovered that somehow the code form was completely blank. Based on the last comment I added back in:

Public Class frmName

End Class

and Designer started working again. Not sure what about my app or VS that causes this to be deleted at runtime but at least now I know how to get past this issue. Thanks.
0
 
LVL 1

Author Comment

by:tmostad
ID: 17966848
One other thing, I just noticed that my user defined code somehow got appended to the DesignerGenerated code. I put it back where it belongs and all is now well. Weird.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Need help with a query 6 55
Convert string to date 3 40
.Net Web Site Password specs 2 20
Form design in vb.net 7 18
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now