473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Referencing a DLL from code-behind

Newbie question: How can a dll be referenced from the code-behind for
an aspx page? I have the dll in the /bin directory, and have tried
using the line "Imports [dllname.dll]" in the code-behind, but I get a
compiler error message that the dll can't be found. This is a dll
that I did not create, and so I'm not sure how to determine what the
namespace is, if that's even what I need to do. I'm also trying to do
this without pre-compiling the code-behind, but that's not a
requirement. Thanks.
Nov 18 '05 #1
4 1331
Imports allows to import "NameSpaces" not to reference DLL. AFAIK this is
actually done by the compiler.

What is your IDE ? (In VS.NET you'll add a reference to the DLL).
"Mark Hageman" <ma****@fuse.net> a écrit dans le message de
news:65*************************@posting.google.co m...
Newbie question: How can a dll be referenced from the code-behind for
an aspx page? I have the dll in the /bin directory, and have tried
using the line "Imports [dllname.dll]" in the code-behind, but I get a
compiler error message that the dll can't be found. This is a dll
that I did not create, and so I'm not sure how to determine what the
namespace is, if that's even what I need to do. I'm also trying to do
this without pre-compiling the code-behind, but that's not a
requirement. Thanks.

Nov 18 '05 #2
I'm sorry; I should have mentioned I'm using WebMatrix. Thanks for your
help!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3
Ok, I finally saw the DLL is in /bin so AFAIK you shouldn't have to
reference the DLL.

You can see the classes with the class browser that comes with WebMatrix.
These classes are readily available.
The "Imports" statements will allow just to reference one of these classes
without having ot use its full name.

Patrice

"Mark Hageman" <ma****@fuse.net> a écrit dans le message de
news:Ob*************@TK2MSFTNGP11.phx.gbl...
I'm sorry; I should have mentioned I'm using WebMatrix. Thanks for your
help!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #4
That makes sense; but now, when I try to invoke a method on the dll, I
get an "is not defined" error. Here's the code:

' MyFax.vb
'

Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HTMLControls

Public Class MyFax
Inherits Page

Protected WithEvents btnSend as button

sub Button_Click( s as object, e as eventargs)
Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
Dim objFaxServer As New FAXCOMEXLib.FaxServer
Dim objSender As FaxSender
Dim JobID As Variant

'Error handling
On Error GoTo Error_Handler

'Connect to the fax server
objFaxServer.Connect "[servername]"

'Set the fax body
objFaxDocument.Body = "c:\Docs\Body.txt"

'Name the document
objFaxDocument.DocumentName = "My First Fax"

'Set the fax priority
objFaxDocument.Priority = fptHIGH

'Add the recipient with the fax number
objFaxDocument.Recipients.Add "5551212", "Jon"

'Choose to attach the fax to the fax receipt
objFaxDocument.AttachFaxToReceipt = True

'Set the cover page type and the path to the cover page
objFaxDocument.CoverPageType = fcptSERVER
objFaxDocument.CoverPage = "generic"

'Provide the cover page note
objFaxDocument.Note = "Here is the info you requested"

'Provide the address for the fax receipt
objFaxDocument.ReceiptAddress = "so*****@example.com"

'Set the receipt type to email
objFaxDocument.ReceiptType = frtMAIL

'Specify that the fax is to be sent at a particular time
objFaxDocument.ScheduleType = fstSPECIFIC_TIME

'CDate converts the time to the Date data type
objFaxDocument.ScheduleTime = CDate("4:35:47 PM")

objFaxDocument.Subject = "Today's fax"

'Set the sender properties.
objFaxDocument.Sender.Title = "Mr."
objFaxDocument.Sender.Name = "Bob"
objFaxDocument.Sender.City = "Cleveland Heights"
objFaxDocument.Sender.State = "Ohio"
objFaxDocument.Sender.Company = "Microsoft"
objFaxDocument.Sender.Country = "USA"
objFaxDocument.Sender.Email = "so*****@microsoft.com"
objFaxDocument.Sender.FaxNumber = "5551212"
objFaxDocument.Sender.HomePhone = "5551212"
objFaxDocument.Sender.OfficeLocation = "Downtown"
objFaxDocument.Sender.OfficePhone = "5551212"
objFaxDocument.Sender.StreetAddress = "123 Main Street"
objFaxDocument.Sender.TSID = "Office fax machine"
objFaxDocument.Sender.ZipCode = "44118"
objFaxDocument.Sender.BillingCode = "23A54"
objFaxDocument.Sender.Department = "Accts Payable"

'Save sender information as default
objFaxDocument.Sender.SaveDefaultSender

'Submit the document to the connected fax server
'and get back the job ID.

JobID = objFaxDocument.ConnectedSubmit(objFaxServer)

MsgBox "The Job ID is :" & JobID(0)
Exit Sub

Error_Handler:
'Implement error handling at the end of your subroutine. This
implementation is for demonstration purposes
MsgBox "Error number: " & Hex(Err.Number) & ", " & Err.Description
end sub
End Class


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Simon | last post by:
Am using the following code. <script language="JavaScript1.2"> function setquantity(productindex,productquantity) { //create the reference object irefname_none = eval("document." +...
11
by: Milind | last post by:
Hi, I was trying to implement a composition relation, somthing of the following type: class A { public: class B {
6
by: jstaggs39 | last post by:
I want to create a Dcount and an If...Then...Else statement to count the number of records in a table based on the date that is entered to run the form. The If....Else statment comes in because if...
12
by: Mark Broadbent | last post by:
Hi guys, just going through remoting at the moment and a couple of questions relating to .net in general has surfaced. Firstly I have seen in the designer that for the namespace and many of its...
6
by: Mikey_Doc | last post by:
Hi We are running cms 2002, Framework 1.0 with Visual studio 2002. We have just upgraded to Framework 1.1 and visual studio 2003. All of our database connection strings are stored within the...
3
by: Lyners | last post by:
I have a table within a cell of a datagrid. I am doing updates without postback to the server using Javascript. I have everything working, except referencing a table within the datagrid cell. ...
9
by: Brett Romero | last post by:
Say I have a library (A.dll) with a method that accepts a collection of a specific type. The type is defined in B.dll. In A.dll, I need to loop through this collection and reference fields of...
2
by: Axel | last post by:
Hi, a question about something that seems very simple at first glance: is it possible to reference other controls of a subform in a query window without referencing through the parent form? I...
1
by: Tim F | last post by:
Problem: I'm receiving the error "File or assembly name XXXXX or one of its dependencies, was not found." when trying to execute code in an assmebly that has both a strong-name and has been...
2
by: Andrus | last post by:
I need compile in-memory assembly which references to other in-memory assembly. Compiling second assembly fails with error Line: 0 - Metadata file 'eed7li9m, Version=0.0.0.0, Culture=neutral,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.