Names Space on Different Projects

  • Thread starter Thread starter Cypher Drive
  • Start date Start date
C

Cypher Drive

Hi,

Please help me on this one.

How will I be able to access namespace on different projects containted in
one Solution using VB.NET 2005. Please help
by providing sample codes.

Pseudo :

Project1
Form1
Class1
Class2

Project2
Form1
Class1
Class2


TY.
 
Cypher Drive said:
Hi,

Please help me on this one.

How will I be able to access namespace on different projects containted in
one Solution using VB.NET 2005. Please help
by providing sample codes.

Pseudo :

Project1
Form1
Class1
Class2

Project2
Form1
Class1
Class2


TY.

Hi,

You need to add references before you access classes in another project.
Right click the project you want to read from another project and select "Add
reference ..." Select the Project tab and doubleclick the other project.
You should then be able to do create objects from another project.

'Inside Project2
Dim f as new Project1.Form1

If class names are unique you could also add Imports Project1 on top of the
code file in Project 2 and create the object directly.

Imports Project1
....
Dim f as New UniqueForm
 
Morten,

Your suggestion nicely executed on my computer only that when I run the Form
I'm receiving the Error Message :

Scenario :

Solution 1
PurchasingSystem - Project
Child - Form (Only the Background Color and size was changed)
Parent - Form (Only the Background Color and size was changed)
RS - Inherited Form based on Parent Form

Public Class RS
Inherits Purchasing_System.Parent

Private Sub RS_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

End Class

WindowsApplication1 - Project
Employee - Class
Form1 - Form



Note :

Purchasing Project Dependencies was: WindowsApplication1
Startup Form - RS


This Error Occurs After I run the Form :

One or more errors encountered while loading the designer. The errors are
listed below. Some errors can be fixed by rebuilding your project, while
others may require code changes.

The path is not of a legal form.
Hide

at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
at System.IO.Path.GetFullPathInternal(String path)
at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile)
at
Microsoft.VisualStudio.Design.VSTypeResolutionService.AddProjectDependencies(Project
project)
at
Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly()
at
Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String
fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly,
String description)
at
Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchProjectEntries(AssemblyName
assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly)
at
Microsoft.VisualStudio.Design.VSTypeResolutionService.GetType(String
typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType)
at
Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String
name, Boolean throwOnError, Boolean ignoreCase)
at
Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String
name)
at
System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.GetType(String
typeName)
at
System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager
manager)
at
System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
manager)
at
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
serializationManager)
at
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32
fReload)
 
Cypher Drive said:
Morten,

Your suggestion nicely executed on my computer only that when I run the Form
I'm receiving the Error Message :

Scenario :

Solution 1
PurchasingSystem - Project
Child - Form (Only the Background Color and size was changed)
Parent - Form (Only the Background Color and size was changed)
RS - Inherited Form based on Parent Form

Public Class RS
Inherits Purchasing_System.Parent

Private Sub RS_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

End Class

WindowsApplication1 - Project
Employee - Class
Form1 - Form



Note :

Purchasing Project Dependencies was: WindowsApplication1
Startup Form - RS


This Error Occurs After I run the Form :

One or more errors encountered while loading the designer. The errors are
listed below. Some errors can be fixed by rebuilding your project, while
others may require code changes.

The path is not of a legal form.
Hide

at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
at System.IO.Path.GetFullPathInternal(String path)
at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile)
at
Microsoft.VisualStudio.Design.VSTypeResolutionService.AddProjectDependencies(Project
project)
at
Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly()
at
Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String
fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly,
String description)
at
Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchProjectEntries(AssemblyName
assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly)
at
Microsoft.VisualStudio.Design.VSTypeResolutionService.GetType(String
typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType)
at
Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String
name, Boolean throwOnError, Boolean ignoreCase)
at
Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String
name)
at
System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.GetType(String
typeName)
at
System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager
manager)
at
System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
manager)
at
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
serializationManager)
at
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32
fReload)





Morten Wennevik said:
Hi,

You need to add references before you access classes in another project.
Right click the project you want to read from another project and select
"Add
reference ..." Select the Project tab and doubleclick the other project.
You should then be able to do create objects from another project.

'Inside Project2
Dim f as new Project1.Form1

If class names are unique you could also add Imports Project1 on top of
the
code file in Project 2 and create the object directly.

Imports Project1
...
Dim f as New UniqueForm

Without seeing the actual code its hard to determine what is wrong.
I assume by "running" Form1 you mean opening Form1 in design mode in Visual
Studio,
which means the designer file is not correct or missing information.

To debug the error open of the designer file. VB hides this file by default,
so open your solution explorer. Select the project not working properly,
and click the Show All Files icon second to the right on top of the solution
explorer.
Your Form files should get a + sign. Expand the + sign and double click the
<Form>.Designer.vb file. This file contains the InitializeComponent method
which
is called from the <Form> constructor (something VB also hides from you).
Be careful when you edit this file as it is handled by Visual Studio,
but try commenting out all lines inside InitializeComponent until you find
the line
causing the error. If the error is there even with all lines commented out,
make
sure the namespace and inheritance matches the <Form>.vb file.

If you still can't figure out what is wrong, you can send me the project and
I will take a look at it.
 
Dear Morten,

Thanks for your advice. I've found my error. The link to the Purchasing
Project no longer exist. I only deleted it
so it is now running smoothly.

Many Thanks,






 
Back
Top