Solved

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

Posted on 2010-11-18
11
397 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.Net Data Class 1 44
Telerik RadEditor Control Save 8 37
VB.net VSTO Excel Ribbon error 4 25
How can I change a label on default.aspx from my public class, class1.vb? 11 24
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…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 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