Solved

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

Posted on 2010-11-18
11
398 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

696 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