?
Solved

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

Posted on 2007-04-02
6
Medium Priority
?
330 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
[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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 7

Accepted Solution

by:
dctuck earned 2000 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

A new era in Cloud training has arrived.

A day that will go down in Cloud history.. But are you ready for it? Will you accept this Cloud challenge?

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 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