?
Solved

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

Posted on 2010-11-18
11
Medium Priority
?
399 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
Major Serverless Shift

Comparison of major players like AWS, Microsoft Azure, IBM Bluemix, and Google Cloud Platform

 
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 2000 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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 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