Solved

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

Posted on 2010-11-18
11
383 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
  • 6
  • 5
11 Comments
 
LVL 32

Expert Comment

by:Erick37
Comment Utility
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
Comment Utility
To clarify, that should be in UHFDemoMain.Designer.vb
0
 

Author Comment

by:CASorter
Comment Utility
<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
 
LVL 32

Expert Comment

by:Erick37
Comment Utility
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
Comment Utility
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
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 32

Expert Comment

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

Author Comment

by:CASorter
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

12 Experts available now in Live!

Get 1:1 Help Now