Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4123498
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:37:08+00:00 2026-05-20T23:37:08+00:00

I am using visual studio 2010 and tried to create a class library which

  • 0

I am using visual studio 2010 and tried to create a class library which I then use in an application that will create tasks using the TaskFactory and execute the class functions from the newly created class library. However I get the instance not defined errors in the application.

CLASS LIBRARY:
Assembly Name: GPStream
Root namespace: TFStream

Project with different classes:
GPStream:
gStream.vb,
parserT.vb,
insertDB.vb

Imports System.Data.SqlClient
Imports System.IO
Imports System.Text
Imports System.ComponentModel
Imports System.Net.Mail
Imports System.Threading
Imports System.Threading.Tasks

Public Class gStream
   Private Shared settings As New System.Configuration.AppSettingsReader
   ' application configuration variables'

   Public Sub New()
      getConfigurations()
   End Sub
   ...
End Class


Imports System.IO
Imports System.Web
Imports TFStream
Imports System.Configuration
Imports System.Threading
Imports System.Threading.Tasks


Public Class Form1
    Private gp1 As TFStream.GPStream.gStream = New TFStream.GPStream.gStream()
    ...
End Class

I Do have it added as a reference.

Class library: Assembly name GPStream, Root Namespace GPStream
Project name GPStream, Main Class gStream

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:37:09+00:00Added an answer on May 20, 2026 at 11:37 pm

    Okay, I’ll have it with a perhaps simpler sample which, I hope, will help you achieve your goal.

    Take it we have a business entities project which we want to use within our WinForm project. We then have two projects, say within the same solution for simplicity sake.

    1. WinFormApp (MyCompany.MyProject.WinFormApp.exe);
    2. BusinessEntities (MyCompany.MyProject.BusinessEntities.dll).

    We shall take it as these assembly files contains the same assembly name and default namespace.

    The namespace of my WinFormApp project is: MyCompany.MyProject.WinFormApp
    And: MyCompany.MyProject.BusinessEntities for the class library. Let’s begin with the class library which contains the two following classes:

    1. Customer;
    2. Supplier;
    3. CreditTerms.

    In accounting, these two are used from a different point of views which are Account Receivable for the Customer and Account Payable for the Supplier. Proper Namespace could be assigned to reflect this reality.

    The Customer class shall look like this:

    Imports MyCompany.MyProject.BusinessEntities
    
    Namespace AccountReceivable
        Public Class Customer
            Private _id As Integer
            Private _name As String
            Private _phoneNumber As Long
            Private _creditTerm As CreditTerm
    
            Public Sub New()
                Term = CreditTerm.None
            End Sub
    
            Public Sub New(ByVal pId As Integer _
                            , ByVal pName As String _
                            , ByVal pPhoneNumber As Long)
                _id = pId
                Name = pName
                PhoneNumber = pPhoneNumber
                Term = CreditTerm.None
            End Sub
    
            Public ReadOnly Property Id As Integer
                Get
                    Return _id
                End Get
            End Property
    
            Public Property Name As String
                Get
                    Return _name
                End Get
                Set(ByVal value As String)
                    If (String.IsNullOrWhiteSpace(value)) Then _
                        Throw New ArgumentNullException("Name")
    
                    _name = value
                End Set
            End Property
    
            Public Property PhoneNumber As Long
                Get
                    Return _phoneNumber
                End Get
                Set(ByVal value As Long)
                    _phoneNumber = value
                End Set
            End Property
    
            Public Property Term As CreditTerm
                Get
                    Return _term
                End Get
                Set(ByVal value As CreditTerm)
                    _term = value
                End Set
            End Property
        End Class
    End Namespace
    

    Then, the Supplier class:

    Imports MyCompany.MyProject.BusinessEntities ' Used for the CreditTerm Enum Property'
    
    Namespace AccountPayable
        Public Class Supplier
            ' We will here consider having the same properties as Customer for simplicity.'
        End Class
    End Namespace
    

    And the CreditTerms enumeration which here can be assigned to both a Supplier from which we buy, and a Customer to which we sell. Under that perspective, this class could either be at the root of your project to illsutrate its common use.

    Public Enum CreditTerm
        None
        N30
        N45
        N60
        N90
    End Enum
    

    Then, our WinFormApp project should look something similar to:

    Imports System
    Imports System.Linq
    Imports System.Text
    Imports System.Windows.Forms
    
    Imports MyCompany.MyProject.BusinessEntities 'Indeed you have to add the reference...'
    Imports MyCompany.MyProject.BusinessEntities.AccountReceivable
    
    Public Partial Class Form1
        Inherits Form
    
        Private _netTerm As CreditTerm = CreditTerm.None
        Private _customer As Customer = New Customer()
        Private _supplier As AccountPayable.Supplier = New AccountPayable.Supplier()
        ...
    End Class
    

    Notice here that I have expressly imported the MyCompany.MyProject.BusinessEntities and MyCompany.MyProject.BusinessEntities.AccountReceivable to illsutrate the differences of namespace between the CreditTerm enumeration and the Customer class. Therefore, I have not imported the the Supplier class’ namespace, which obliges me to point to the location where to find the class.

    In the end, I could have had MyCompany.MyProject.BusinessEntities.Customer namespace to group everything that regards a customer under the same namespace while having the Customer class inside the Customer namespace. But then, even when importing the namespace, you would have to write the following:

    Private _customer As Customer.Customer = New Customer.Customer()
    

    Another thing comes to mind while writing. Try to build/generate/regenerate the class library, then add it as a reference. Perhaps your project where the class library is referenced can’t find the binaries, except if you did reference it through a Project Reference.

    Please feel free to ask any question about misunderstood details or so, or even to say I myself have perhaps misunderstood your question and concerns.

    I really DO hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Visual Studio 2010 to create a Silverlight 4 application. I set
I'm using Visual Studio 2010 to create a Word Template. I created a Ribbon
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I am using Visual Studio, developing a native application, I have a programmatical breakpoint
Consider the following code (written with Visual Studio 2010 and .NET 4.0) using System;
Right now i'm exploring LINQ-to-SQL using Visual Studio 2010 beta. I'm trying to understood
I'm using Visual Studio 2010 Express with Framework 4.0 and if I am correct,
I am using Visual Studio 2010 (c++), and Intellisense has stopped working. I've read
I am trying to attach to a windows service using Visual Studio 2010 →
I have created my first dll using c# and visual studio 2010. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.