[ delegation ]

robawillis

New Member
I wrote a custom assembly to assist my with my data access. I want to be able to use the methods exposed by this assembly in a separate custom control I wrote that displays a dropdown list based on some fields in a DB. This is a 'uses a' relationship but I don't know how to allow the control to inherit the functionality of my data object. When I add the line:<BR><BR>using MyDataObject;<BR><BR>it returns an error at compile time. 'Cannot find this reference' or something of the like. How do I allow my controls to use eachother in the same way that any of my controls can inherit the functionality exposed by the .NET framework?<BR><BR>Note: <BR><BR>1.) the assemblies have all been placed in the /bin folder/<BR>2.) all files are written or maked up in csharp, a text editor.<BR>3.) Visual Studio is not at my disposal.<BR>4.) The assembly that controls data access works when imported to a regular csharp page.<BR><BR><BR>Thanks in advance!the using statemnt is only to import the namespace so you don't have to type out the full type of each object everytime you reference that type.<BR><BR>System.Data.OleDb.OleDb.OleDbDataAdapter myAdapter = new System.Data.OleDb.OleDbDataAdapter();<BR><BR>versus<BR><BR>using System.Data.OleDb;<BR>OleDbDataAdapter myAdapter = new OleDbDataAdapter();<BR><BR>As should be obvious, if you have a lot of references to a certain namespace, using the 'using' saves a lot of typing and should greatly increase the readability of your code.<BR><BR>However, I think the problem you are running into is during the compilation of your code that you want to call your class from. You will need something like:<BR>csc /r:<yourdll>.dll <yourfile>.cs<BR><BR>The /r flag will add the reference to you assembly. Without knowing your namespaces and filenames giving the exact statement is not possible.<BR><BR>O'Cary<BR><BR><BR>&nbsp;<BR>set indir=C:InetPubwwwrootinStems_AssembliesStemsCont rol.cs<BR>set outdir=C:InetPubwwwrootinStemsAutoSelectBox.dll<BR>set assemblies=System.dll,System.Web.dll,StemsDataComp onents.dll<BR><BR>csc /t:library /out:%outdir% %indir% /r:%assemblies%<BR>pause<BR>exit<BR><BR>------------------<BR><BR><BR>This is the compiler commands I've placed in a batch file that I'm using as of now. It claims that it cannot find the metadata file StemsDataComponents.dll<BR><BR>What does this mean?<BR><BR>Thanks in advance!<BR><BR>Kevin Mesiab...<BR>set assemblies=binUtil.dll<BR>csc /nologo /t:library /d:TRACE /out:%outdir% %indir% /r:%assemblies%<BR><BR>this is directly out of one of my batch jobs. I believe the assemblies will be reference off of a relative path, so your compile command is looking for the stems .dll in the directory you are at at the time of running the batch file. So either specify the correct relative path to the stems dll or put in an absolute path starting with the drive letter. (Also, I don't think you need to include assembly references.)<BR><BR>You are absolutely right! It seems that it's the obvious that pass us by when we are looking too hard. I did as you suggested and the control compiled without problem. Thanks for your help!
 
Top