DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Can a form file be edited as a text file?

  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Can a form file be edited as a text file?

    I'm a newbie on .net and now starting to use VB.net.

    I opened a .designer.vb file of a form and edited a control. Later on I found I could not view the form in [design] view any more. The icon of the .vb file has changed from a form to a vb code file.

    Is there anyway / chance to change it back, to let the environment recognize the .vb file as a form? Can a form file be edited as a text file?

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    What did you do on the "edit"?

    When you tried to view the form from the IDE, what happened?

    Are we talking about a Windows Form or a Web Form?

  3. #3
    Join Date
    Mar 2009
    Posts
    2
    It's a windows form.

    What I did is:
    1. show all files in Solution Explorer and expanded Form1
    2. double clicked on Form1.Designer.vb
    3. changed one control name in the Sub InitializeComponent()
    4. ran it and got error
    5. changed the control name back, the error was eliminated and the program ran normally
    6. I found the icon of Form1.vb in Solution Explorer has changed from a form icon to code file icon and I could not view the form in [design] mode. The form is recognized by VB.net as a code file, when view the form in IDE, I get the code, not a form displayed.

    I had crashed certain thing. My concern is in this case, can I change the code file back to a form to edit my form intuitively?

  4. #4
    Join Date
    Jun 2009
    Posts
    1
    Edit the project (.vbproj) file. Change the offending element's SubType from "Code" to "Form". Most of the time you'll get the Form icon back. Sometimes you'll get the Component icon. In either case you should then get the 'View Designer' option in the solution explorer.

    <Files>
    <Include>
    <File
    RelPath = "AssemblyInfo.vb"
    SubType = "Code"
    BuildAction = "Compile"
    />
    <File
    RelPath = "Form1.vb"
    SubType = "Form"
    BuildAction = "Compile"
    />

  5. #5
    Join Date
    Jun 2008
    Posts
    8

    You are dditing the wrong file

    The first error was in editing the form1.designer.vb. That is the file that is created by the forms designer and contains the _generated_ code associated with the form. You should not change it because any changes in it are 1) not reflected in the form itself, 2) will probably get lost when the designer closes the form. You should open the form1.vb file in the designer and make your changes in the visual forms designer.


    Quote Originally Posted by SnoopyYang View Post
    It's a windows form.

    What I did is:
    1. show all files in Solution Explorer and expanded Form1
    2. double clicked on Form1.Designer.vb
    3. changed one control name in the Sub InitializeComponent()
    4. ran it and got error
    5. changed the control name back, the error was eliminated and the program ran normally
    6. I found the icon of Form1.vb in Solution Explorer has changed from a form icon to code file icon and I could not view the form in [design] mode. The form is recognized by VB.net as a code file, when view the form in IDE, I get the code, not a form displayed.

    I had crashed certain thing. My concern is in this case, can I change the code file back to a form to edit my form intuitively?

Similar Threads

  1. writing to a text file
    By persian_celina in forum .NET
    Replies: 0
    Last Post: 02-19-2006, 03:06 AM
  2. Importing text file using schema.ini
    By Kevin in forum VB Classic
    Replies: 3
    Last Post: 12-05-2005, 07:25 PM
  3. Replies: 1
    Last Post: 03-23-2005, 12:18 AM
  4. Replies: 0
    Last Post: 08-22-2000, 10:54 PM
  5. Replies: 0
    Last Post: 04-17-2000, 01:33 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center