|
I want to add another external dll to this file for example add.dll to this file test.cs
ALL THE BEST
|
|
|
|
|
You can not add a reference in a class library project to another dll at run-time because there will never be a run time for a class library, it is not executable. Of course depending on your level, you can make a dll to run as a standalone application with Rundll or Rundll32 commands from Windows to run functions in your class library(mylib.dll). In this scenario, you can add a "reference" by calling Assembly.Load(...), Assembly.LoadFile(...) or Assembly.LoadFrom(...) methods available in System.Reflection namespace. If you want to copy a dll to your working folder and then add a reference to it, then you can use File.Copy or File.Move functions in System.IO namespace. I hope this helps you friend.
|
|
|
|
|
Thank you so much for the response guys.
Here below is the peice of code which i tried it but failed
Assembly SampleAssembly;
System.Reflection.AssemblyName objName = new AssemblyName();
objName.CodeBase = "D:\\Debug\\Utilities.EncryptParm.dll";
SampleAssembly = Assembly.Load(objName);
Type[] Types = SampleAssembly.GetTypes();
foreach (Type oType in Types)
{
Console.WriteLine(oType.Name.ToString());
if(oType.Name == "EncryptParm")
{
string[] encryptValues = {"4865","78043","GABRIELEZZ"};
string encryptKey = "CF2ASP?73ejb01";
Utilities.EncryptParm encryptor = new Utilities.EncryptParm();
string encryptedId = encryptor.Encrypt( encryptKey, encryptValues);
Console.WriteLine(encryptedId);
Console.ReadLine();
}
}
Please rectify me for any correction
Thanks In Advance
|
|
|
|
|
vamsimohan21 wrote: Utilities.EncryptParm encryptor = new Utilities.EncryptParm();
string encryptedId = encryptor.Encrypt( encryptKey, encryptValues);
You cannot execute this when you have loaded the assembly by using Assembly.Load. You have to call InvokeMember(...) instead.
Hope this helps.
|
|
|
|
|
YOU HAVE NOT READ MY PREVIOUS ANSWER TO YOUR QUESTION, BUT I SEND YOU A NEW ONE FOR THE LAST TIME
Use below code:
string assemblyFullPath = @"C:\myAssembly.dll";
Assembly workerAssembly = LoadAssembly(assemblyFullPath);
Type[] types = workerAssembly.GetTypes();
foreach (Type oType in types)
{
Console.WriteLine(oType.Name.ToString());
if(oType.Name == "EncryptParm")
{
string[] encryptValues = {"4865","78043","GABRIELEZZ"};
string encryptKey = "CF2ASP?73ejb01";
Utilities.EncryptParm encryptor = new Utilities.EncryptParm();
string encryptedId = encryptor.Encrypt( encryptKey, encryptValues);
Console.WriteLine(encryptedId);
Console.ReadLine();
}
}
|
|
|
|
|
AFSEKI wrote: there will never be a run time for a class library, it is not executable.
Yes, it is! It isn't directly executable, it requires something else to form the process for it, but a class library is as executable as any other .NET code.
|
|
|
|
|
If you read my post completely not only 1 sentence of it you could see that I tell how a dll can be run. You are a very excited young boy he?
|
|
|
|
|
AFSEKI wrote: If you read my post completely not only 1 sentence of it you could see that I tell how a dll can be run.
I did read your entire post. The latter part of your post contradicted the former part. I clarified it.
AFSEKI wrote: You are a very excited young boy he?
I'm neither young, nor exited. I'm old and grumpy.
|
|
|
|
|
I think you can't do that as it is only a CS file.
by the way what you want to achieve by doing this ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
this code doesnt remove all child from the node it removes only first child and then exit. why is that so can any one help me .. or how shld i dlete each node one by one
XmlDocument xsd=new XmlDocument();
xsd.Load(@"D:\test\fileinf.xml");
XmlElement elem= xsd.DocumentElement;
XmlNodeList lis= elem.ChildNodes;
foreach(XmlNode node in lis)
{
node.ParentNode.RemoveChild(node);
}
xsd.Save(@"D:\test\fileinf.xml");
the xml document is
</xml version="1.0" encoding="utf-8"?>
<files>
<filename>8.txt</filename>
<filename>9.txt</filename>
<filename>10.txt</filename>
<filename>11.txt</filename>
<filename>12.txt</filename>
<filename>13.txt</filename>
<filename>14.txt</filename>
<files>
plz do help
|
|
|
|
|
A foreach statement should not be used to change the content of a collection, so replacing it with a for-loop should solve the problem. However, the easiest way would be calling RemoveAll .
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
how to find ebook on c#2 ?
|
|
|
|
|
A lot of books these days come with a CD in the back with the ebook version.
|
|
|
|
|
Best one is MSDN try to get MSDN for VS 2005 if you know some what DOt Net
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Generally, there are two ways.
1 - buy the book
2 - steal the book from a website full of illegal e-books.
I recommend way# 1.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
|
Hi,
I have an requirement to read the data from excel sheets. Excel work book contains 5 sheets. Each day I have to read 5 different sheets. How should I code so as to read a particular sheet on each day(for eg: Monday - Sheet1; Tuesday - Sheet 2 like that). And also I need only to read the values from one colum, say column C.
Also, there are chances the sheets gets updated by the users often. So can I read the data eventhough the file is open?
Any help in this regard will be great. Please provide the code, if possible.
The application is in C# and I'm using VS.Net 1.1
Meeram395
|
|
|
|
|
|
Hi,
Thank you for your efforts and timings. I can use this component in one of my other application.
But, in this application, the no.of rows may exceed 150. It will be upto 15000 max and also the sheets are likely to increase by one or two. So how should I handle in such a case? Is there anyway like Sheets.Find and giving the worksheet name?
Thanks for all your help.
Meeram395
|
|
|
|
|
If I was you..
Use ODBC via ADO.. then its just like accessing a .net dataset.
Sk8tZ
|
|
|
|
|
Hi.
I'm developing a client for a web service which requires SSL authentication(via https).
Normally certificates are installed manually by the the user. But I am assuming that many different users with many different certificates will use the same computer and I don't want to have all the certificates installed at a given time for security reasons.
What I want to do is to implement a mechanism so that the certificate used for authentication can be installed before the web method call and uninstalled afterwards. So I've written a couple methods to do this.
The problem is that the InstallCert method does not install the certificate, but the UninstallCert methods does what's supposed to do, assuming that the certificate in subject has previously been installed in the store(for now I do that manually).
Any clues?
Thanks a lot.
Relevant code below.
X509Store store_Personal = new X509Store(StoreLocation.CurrentUser);<br />
<br />
private void InstallCert(X509Certificate2 theCert)<br />
{<br />
store_Personal.Open(OpenFlags.ReadWrite);<br />
store_Personal.Add(theCert);<br />
store_Personal.Close();<br />
}<br />
<br />
private void UnistallCert(X509Certificate2 theCert)<br />
{<br />
store_Personal.Open(OpenFlags.ReadWrite);<br />
store_Personal.Remove(theCert);<br />
store_Personal.Close();<br />
}
|
|
|
|
|
Low activity on Monday it seems...
I found a way to make it work but I still don't understand why it didn't work in the first place. It's totally unlikely to be a bug, but it seems that way.
So, instead of adding the single certificate to the certificate store, I add a collection of certificates(which only holds one certificate) using the AddRange() method of the X509Store object. And it works.
If you are really really bored and have nothing else better to do you might as well try it. It's just a few lines of code.
Have a nice day!
|
|
|
|
|
hi All,
I am having an application which i wanna select tabs when user clicks on the relevant node.
eg:
Tree View: Tab Page
Main(root)
...Tab1(child)_____tabPage1(Get Slected)
...Tab2(child)_____tabPage2(Get Slected)
...Tab3(child)_____tabPage3(Get Slected)
some thing like that.
I got no idea how o do.
Please help me.
Regards
Ruwandi
rkherath
|
|
|
|
|
Dear Used Thsi Event of Tree View Control
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
textBox1.Text = e.Node.Text;
}
|
|
|
|