|
pakfari:
Use Assembly to load the dll, like so:
Assembly SampleAssembly;
string fullp = ((Full Path to the dll))
SampleAssembly = Assembly.LoadFrom(fullp);
//In order to create an Instance of it you have to grab the type of this class
//use Namespace.ClassName
Type ObjType = SampleAssembly.GetType(Namespace.ClassName);
//Create an instance of your dll here
Activator.CreateInstance(ObjType);
As far as running the Dll, there are a few ways to do it.
but this is how you would/could load it at runtime.
Hope his helps
Steve Welborn
Software Architect
|
|
|
|
|
I will just say Great!!!
It is working ok, can u tell me one more thing. How we can invoke the member functions of the Component using objType.
|
|
|
|
|
Well, this is where it can get tricky..at least for me. Because there are a few ways to do this, depending on if you want to call the function right then, or place that object in a Collections class and call it later. Hopefully someone will be able to explain it better than I can, but here goes.
This is how I executed a .dll after loading it.
Remember that when you created the Instance it passed back an object
object instance; //what Assembly.CreateInstance returns
object[] args; //Parameters to pass the function
MethodInfo method = type.GetMethod(functionname);
object returnval = method.Invoke(instance, args);
I hope this helps.
Steve Welborn
Software Architect
|
|
|
|
|
Hi,
Anybody knows how to write factory interface handler that will call multiple handlers. I'm using Sharepoint Services in my application. In this sharepoint i can able to add only one event handler. But i'm in situation that my sharepoint has to communicate with multiple event handlers. I asked this question in Sharepoint forums. They suggested that "You can write a factory interface handler that calls multiple handlers. " . But i didn't get any suggestion about factory interface handler from them.
If anybody knows how to write factory interface handler that will call multiple handlers.
Thanks in advance,
Vinoth
|
|
|
|
|
They are basically telling you the design pattern for a method that becomes your one event handler, and then farms off the event to other event handlers, based on the code in the class.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for ur information,
Could you please tell me clearly "design pattern for a method that becomes your one event handler nd then farms off the event to other event handlers, based on the code in the class".
I don't know anything about design pattern.
bye,
Vinoth
|
|
|
|
|
Google for 'design patterns'. A design pattern is basically an established design for object oriented software, it's an established way of implimenting something cleanly.
You don't need to know any more than what I said, they are telling you to write an event handler that then sends off events to all the places you want them to go.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hai guys
i'm a newbie to C#. My doubt is is 'InitializeComponent()' is somewhat similar to a constructor.
Is there any special features with 'InitializeComponent()'.
Could anyone share it with me plz.
Thanks in advance
Long Live
|
|
|
|
|
Sreenivasan Palaniappan wrote:
My doubt is is 'InitializeComponent()' is somewhat similar to a constructor.
How do you mean ?
This method is inserted by the IDE, and called to set all the properties that you set up in the forms designer. As such, you should never mess with the code here, your changes will disappear. as such, it's also a form of construction activity, I guess. But you should add any code of your own in the spot just below the call that is commented as being the right spot to do so.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
No ! 'InitializeComponent()' is a common function that run in the form constructor. But in VS.NET IDE this a protected area of code !! If you try to change any line of code in this function IDE will reproduce the original codes at project rebuilds. In fact this is a scope that IDE put the design time initialization of controls and components there.
[ _ Always there is another way _ ]
|
|
|
|
|
What is an easy way to make a program that opens a port on a server and waits for a client to ask for information. How do I do that client part as well? Can your method send both text and numbers?
|
|
|
|
|
I figured it out, you use the TcpListener, and the TcpClient.
|
|
|
|
|
I want to open a new form in a Windows Application in C# in its own thread. The form has a constructor that takes some parameters (always). The form updates a Flexgrid upon events fired from a live datafeed. The updates can happen quite often and I may have multiple forms open at once with multiple updates happening at once. I have tried to start a new thread, but does not appear to keep the whole form in a new thread.
Any suggestions would be appreciated.
Thanks
|
|
|
|
|
How are you opening the form in the thread? What exactly do you mean by
wdahl99 wrote:
but does not appear to keep the whole form in a new thread.?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
How can you capture the logon and log off event in windows xp.
I am creating a windows service that needs to do something when a user logs on to their account in xp and logs off from their account. It would be good if I can capture their Username as well so I know who is logging on and off.
|
|
|
|
|
|
Thanks
This is good to find out which user is currently logged on. But how can I fire off and event when they log on and off.
|
|
|
|
|
I'm trying to take a numeric value from a textBox and compare it against another numeric value that is supplied by the app, but i'm stuk trying to convert the string value of the textBox1.Text to int value for the if statement, i keep recieveing the following errors:
Cannot implicitly convert type 'string' to 'bool'
Cannot implicitly convert type 'int' to 'string'
here is the code:
private void button1_Click(object sender, System.EventArgs e)
{
string myID;
TextBox txtbx = new TextBox();
txtbx.Text = myID;
if (myID = 123)
MessageBox.Show("You are right");
}
I've tried changing the string myID to int myID but it hasn't proven any better, as i get the same errors listed above with int to bool, and int to string as the only difference.
also i'm getting a slightly less important error of:
Use of unassigned local variable 'myID' which i understand means i haven't initiated the variable, but its failing inside the if statement.
I'm still learning so if you guys could help it would be great.
thanks
newbie
|
|
|
|
|
Anonymous wrote:
if (myID = 123)
You are assigning myID with the value of 123 in this if statement. Are you sure this is what you want?
If you want to compare with 123, then it should be
if(myID == "123")
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Weiye Chen wrote:
You are assigning myID with the value of 123 in this if statement. Are you sure this is what you want?
well the truth of the matter is that in the end the desired result will be to pull the data from either a db or assign a solid value at a later date, right now i was just trying to get the unit to run.
thanks for the quotes..... that worked.
any ideas on the "Use of unassigned local variable 'myID'" ?
newbie-
|
|
|
|
|
Anonymous wrote:
"Use of unassigned local variable 'myID'"
This is because you had declare the variable myID and used it without assigning any value to it such as this
txtbx.Text = myID; Since myID has not been assigned any value, txtbx.Text would therefore have an unknown value/type which can be dangerous.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
If you want to compare a string with a number you should convert the string at first.See the following code :
if(intValue == int.Parse(textBoxText))
{...}
[ _ Always there is another way _ ]
|
|
|
|
|
A friend had wrote that you can use the if statement as if (txtbx=="123")... this is axactly true and there is anoher way to convert your variable MyID. you can do it like this:
Convert.ToInt32(txtbx.Text)...
but there is and issue here, at the beginning you must define your variable as integer. if you define a string variable and then if you try to assign it to integer variable you will have the similar problems.
Good Luch on your work. i hope you will be succesfull...
sayinsinan
|
|
|
|
|
I would like to figure out the best way to add a DatePicker to a webform. I am currently just have a button on the webform. When the button is pressed, I would like the Calendar to popup. I also have the calendar inside of a div. I am not quite sure how to make the calendar show up when the button is clicked.
Eric
|
|
|
|
|
There are a number of solutions to this problem on the web already.
Christian Graus - Microsoft MVP - C++
|
|
|
|