how to get visual studio to reconize a compiled component

G

Guest

thanks much!!!i'm working through an example that creates a component called
component.dll. This compiled ok w/o problem. I copied it to the bin directory
of my project (vs.net asp.net vb project) when i attempt to reference it in
my source it is not found. and when i compile it same thing. how do i get my
program to reconize this class.
using code behind.
here is my source:

Imports component <--- is not found how do i add it?
Imports System.Data
Imports System.Data.SqlClient


Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents dgrdDatagrid1 As System.Web.UI.WebControls.DataGrid

'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim simplecomponent As New Simple
Dim dataset As New DataSet
dataset = simplecomponent.loadDataSet()
dgrdDatagrid1.DataSource = dataset
dgrdDatagrid1.DataBind()

End Sub

Private Sub dgrdDatagrid1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
dgrdDatagrid1.SelectedIndexChanged

End Sub
End Class
 
G

Guest

i think i figured it out, but don't know for sure. I added a reference in
project/reference. Do ireally need to do this ? i thought it wouold pickup
automaticly.
if this is necessary here how about on the production server? do i need to
add a reference there also?
thanks
kes
 
S

Sylvain Lafontaine

It must be added to the reference, either explicitly in the ASP.NET page or
in the Web.config file or in the list of references for that project.

The most easy way to do this, in your case, is first to add the
component.dll project to the same solution as your asp.net vb project.
Then, from the References node for the asp.net vb project, you choose from
the contextual menu (right click of the mouse) Add Reference --> Projects
(third tab) --> Double click on your component.dll project --> choose
component.dll at the bottom of the window.

The component.dll library will be added to the list of references for your
vb.project, with the property Copy Local set to True and will also be marked
as a dependency to be compiled first in the list of dependencies for asp.net
vb project (menu Project --> Project Dependencies --> ...).

The "Imports component" will not be necessary; it is simply a shortcut for
importing the namespace "component"; otherwise you have the obligation of
writing the namespace before your objects:

Dim simplecomponent As New component.Simple

instead of:
Dim simplecomponent As New Simple

but by itself, it doesn't add any reference to an external library or
module.

From there, all the rest will be done automatically by VS.NET; including
rebuilding/ relinking/ copying the component.dll library when necessary.

S. L.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top