Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Forms Design View
 

Forms Design View

I have only just started 'messing about' with Visual Basic 2005 Express and I'm hoping this is just a dumb new starter error!

I created a project following one of the user guides in the help area. It was a form with a text box and a button, nothing fancy. However, I am unable to now view the form in design view to resize it, move the button, etc. According to help, I should be able to double-click on the form name in the solution explorer but this just brings up a blank code page.

Any pointers gratefully received as I don't fancy restarting the project just so to reposition a button!

;-)

ladymuck  Wednesday, December 28, 2005 5:24 PM

Ok, let me see if I can give a few pointers here. I have to say I don't have VB experience, but maybe my C# experience applies to VB as well.

You are right, double-clicking on a form or control should get you the designer. If it doesn't you might want to try the following:

-Right-click on the form. Here you should be able to select to view the code or the designer.

-In C#, you can switch from design to code and vice versa by using the F7 / Shift-F7 keys. These are the defaults.

If all of this doesn't work, it might be that the form is incorrectly marked as something else than a form. I remember from some time ago I had a similar problem and I fixed this by open the project file in a text editor. In C# this is the csproj file, an xml file. The subtype of the file is shown here, like this:


    <Compile Include="Form1.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Form1.Designer.cs">
      <DependentUpon>Form1.cs</DependentUpon>
    </Compile>
    <EmbeddedResource Include="Form1.resx">
      <SubType>Designer</SubType>
      <DependentUpon>Form1.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     <SubType>Designer</SubType>

These are the three files that belong to a form. You can also see how they are linked to each other with dependencies. I believe that the subtypes is what the designer uses to identify it as a designable form. Note that this is different for components and controls. If your form looks different, with different subtypes, you might want to try to change the type (make a backup first please).

Don't know if all of this applies to VB. At least I gave it a shot .

Jelle van der Beek2  Wednesday, December 28, 2005 6:31 PM

Ok, let me see if I can give a few pointers here. I have to say I don't have VB experience, but maybe my C# experience applies to VB as well.

You are right, double-clicking on a form or control should get you the designer. If it doesn't you might want to try the following:

-Right-click on the form. Here you should be able to select to view the code or the designer.

-In C#, you can switch from design to code and vice versa by using the F7 / Shift-F7 keys. These are the defaults.

If all of this doesn't work, it might be that the form is incorrectly marked as something else than a form. I remember from some time ago I had a similar problem and I fixed this by open the project file in a text editor. In C# this is the csproj file, an xml file. The subtype of the file is shown here, like this:


    <Compile Include="Form1.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Form1.Designer.cs">
      <DependentUpon>Form1.cs</DependentUpon>
    </Compile>
    <EmbeddedResource Include="Form1.resx">
      <SubType>Designer</SubType>
      <DependentUpon>Form1.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     <SubType>Designer</SubType>

These are the three files that belong to a form. You can also see how they are linked to each other with dependencies. I believe that the subtypes is what the designer uses to identify it as a designable form. Note that this is different for components and controls. If your form looks different, with different subtypes, you might want to try to change the type (make a backup first please).

Don't know if all of this applies to VB. At least I gave it a shot .

Jelle van der Beek2  Wednesday, December 28, 2005 6:31 PM
Thank you. This solved the issue that I just encountered. However, I have noticed that it likes to spontaneously change back and remove the subtype. I have had to change the property of the .vbproj file to read only to prevent this from happening over and over again. Is there a permanent solution?
KWilliams1  Friday, January 20, 2006 2:36 PM
I personally don't know what causes this behaviour, sorry. If I find out I will post it here.
Jelle van der Beek2  Tuesday, January 24, 2006 9:03 AM

You can use google to search for other answers

Custom Search

More Threads

• Possible to code serialize a collection of usercontrol-derived types?
• How to convert string to Image
• Taking backup of SQL Server 2000 database in VB.Net 2005?
• VS2005 - Form Design error !
• Mask for DateTime field in PropertyGrid
• Data binding in Win Forms
• Auto Format
• Problems with object type Data Sources in Visual Studio
• Own combobox problem with focus
• _MYFORMS=True What is this constant and why designer gets lost when not having it?