Solved

Copying a Form from another VB.NET project in 2005 version

Posted on 2007-04-02
6
320 Views
Last Modified: 2013-11-26
Hi,
I have a VB.NET 2005 project where I want to add an existing form from another VB.NET 2005 project.
When I right click my project and add an Existing item, I select all 3 files for the form i.e. the .vb file , the designer.vb file and the .resx file.

After the form gets added, when I double-click it, the form does not open. It gives some error message.

2 questions:
1. What is right way to import a form into an existing project ?
2. Why does .NET 2005 generate a separate designer file for a form ? Earlier in 2003, everything was in the same .vb file.
0
Comment
Question by:rajesh_khater
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:dctuck
ID: 18836608
1. What is the error message you receive? Generally, the method you mentioned would work
2. I think Microsoft decided it would be less confusing for developers if the UI code was separate from the business logic...
0
 
LVL 25

Expert Comment

by:dstanley9
ID: 18836713
The reason for the separate "designer" file is because of the use pf partial classes.  Now, the "designer" code (the code that studio generates to turn the visual form into code) is in a separate file from the custom code, so you don't have the "Designer Generated Code - Do not Modify" region (or something like that).  
0
 
LVL 1

Author Comment

by:rajesh_khater
ID: 18841612
But if I want to see the generated UI code from my project, is there a way I can add it to  my project ?
Can I safely modify the generated code ?
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 7

Accepted Solution

by:
dctuck earned 500 total points
ID: 18841714
You can modify it, but the reason Microsoft "hid" those designer files is because you just have to be very careful with what you are doing. To view the Designer files, click on the Show All Files button in your Solution Explorer tab (second button from the left). You can then click on the "+" icon to the left of the form you want to display Designer code for. The file will be e.g. Form1.Designer.vb
0
 
LVL 1

Author Comment

by:rajesh_khater
ID: 18842219
While copying a form, is it also necessary to manually select the designer file also, or will Visual Studio automatically detect it and copy it too ?
0
 
LVL 7

Expert Comment

by:dctuck
ID: 18842239
If you just import the main file (e.g. Form1.vb), Visual Studio will automatically detect the Designer and resources files associated with it and also import those.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 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

17 Experts available now in Live!

Get 1:1 Help Now