Solved

vb.net main windows form showing as a class, i cant open the form in design mode

Posted on 2010-11-18
11
396 Views
Last Modified: 2012-08-14
what i have what i need
some how i got my main form set as something other than a form.....

i do not have the option to open it in design mode.

what screw do i need to turn to get it right
0
Comment
Question by:CASorter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 32

Expert Comment

by:Erick37
ID: 34165699
Make sure the designer sets the inheritance correctly

e.g.

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class UHFDemoMain
    Inherits System.Windows.Forms.Form
0
 
LVL 32

Expert Comment

by:Erick37
ID: 34165733
To clarify, that should be in UHFDemoMain.Designer.vb
0
 

Author Comment

by:CASorter
ID: 34165745
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class UHFDemoMain
    Inherits System.Windows.Forms.Form

thats what i got.


it seems like it is a setting or how it was saved some how
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 32

Expert Comment

by:Erick37
ID: 34165776
Also make sure the Class name is the same in the Form as in the Designer.

Form:
Public Class UHFDemoMain

Designer:
Partial Class UHFDemoMain
0
 

Author Comment

by:CASorter
ID: 34165858
i cant open the form.....   :(

thats the problem


a search of the solution only shows the designer class defanition.

the program runs fine....   and at one point i had the design mode open, and could change items on it.   but i closed it and now cant get back to the form design mode.

0
 
LVL 32

Expert Comment

by:Erick37
ID: 34165903
But you can open the form's code, correct?
0
 

Author Comment

by:CASorter
ID: 34165966
yes
it is under the partial class uhfdemomain

as well as the windows form stuff

 <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class UHFDemoMain
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

  'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()





then a whol bunch of code setting up the form



then the code for the objects on the form





0
 
LVL 32

Accepted Solution

by:
Erick37 earned 500 total points
ID: 34166350
Somewhere you must have "Public Class UHFDemoMain"

Usually it's in UHFDemoMain.vb with the rest of the form code.
The designer generated stuff (Partial Class) is in UHFDemoMain.Designer.vb.

Prior to VS2005, the designer code and the Form code was combined in one file.  What version of Visual Studio are you using and how was that form added to the project?



0
 

Author Comment

by:CASorter
ID: 34166547
it is borrowed code from another demo program....


so i am not sure what it was orginally.


where should that public class line be?

0
 
LVL 32

Expert Comment

by:Erick37
ID: 34166741
Assuming you are using Visual Studio 2005 or better:

UHFDemoMain.vb is your code file and should have the form:

Public Class UHFDemoMain

      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

      End Sub

End Class


The designer code (UHFDemoMain.Designer.vb) looks like this:

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class UHFDemoMain
      Inherits System.Windows.Forms.Form

      'Form overrides dispose to clean up the component list.
      <System.Diagnostics.DebuggerNonUserCode()> _
      Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                  If disposing AndAlso components IsNot Nothing Then
                        components.Dispose()
                  End If
            Finally
                  MyBase.Dispose(disposing)
            End Try
      End Sub

more code

End Class


In Visual Studio 2003, all the code was in the .vb file (there was no Partial Class with the designer code separated.)

0
 

Author Comment

by:CASorter
ID: 34166765
added this in
uhfdemomain.vb

Public Class UHFDemoMain
    Inherits System.Windows.Forms.Form
End Class



works fabulously now!


thanks for the pointer.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

740 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