J
Jimmy
Hey
In VS i did apply my Dll under references, but no matter what i do, it seems
like i cant get this thing to work, if i put some UI in my Dll file. I get a
MissingMethodException. I have in the following kode marked the line that
throws the exception.
I call the function in my Dll the following way, even though i have tried
more different ways, but the same thing happens no matter how i do it:
try
{
Upd_Comp upd = new Upd_Comp(this);
}
catch (MissingMethodException g)
{
MessageBox.Show(g.Message.ToString());
}
My Dll consists of 2 .cs files looking like the following:
using System;
using System.Threading;
using System.Diagnostics;
namespace kompDll
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Upd_Comp
{
public Upd_Comp(System.Windows.Forms.Form mainform)
{
//
// TODO: Add constructor logic here
//
test();
}
private void test()
{
frm_Statusdll frm_Stat = new frm_Statusdll();
frm_Stat.Show();
}
}
}
and the other file looks like this:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace kompDll
{
/// <summary>
/// Summary description for status.
/// </summary>
public class frm_Statusdll : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public frm_Statusdll()
{
//
// Required for Windows Form Designer support
//
InitializeComponent(); //AS SOON AS I PRESS STEP INTO ON THIS
LINE IN THE DEBUGGER, IT THROWS THE MISSINGMETHODEXCEPTION.
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(56, 72);
this.label1.Name = "label1";
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// label2
//
this.label2.Location = new System.Drawing.Point(56, 120);
this.label2.Name = "label2";
this.label2.TabIndex = 1;
this.label2.Text = "label2";
//
// frm_Statusdll
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "frm_Statusdll";
this.Text = "statusdll";
this.ResumeLayout(false);
}
#endregion
}
}
The point of all this is that i have to use the same code from more
different places, so instead of writing this a 100 times, i want it to be in
some kind of component that i can call.
Hope that you can help.
In VS i did apply my Dll under references, but no matter what i do, it seems
like i cant get this thing to work, if i put some UI in my Dll file. I get a
MissingMethodException. I have in the following kode marked the line that
throws the exception.
I call the function in my Dll the following way, even though i have tried
more different ways, but the same thing happens no matter how i do it:
try
{
Upd_Comp upd = new Upd_Comp(this);
}
catch (MissingMethodException g)
{
MessageBox.Show(g.Message.ToString());
}
My Dll consists of 2 .cs files looking like the following:
using System;
using System.Threading;
using System.Diagnostics;
namespace kompDll
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class Upd_Comp
{
public Upd_Comp(System.Windows.Forms.Form mainform)
{
//
// TODO: Add constructor logic here
//
test();
}
private void test()
{
frm_Statusdll frm_Stat = new frm_Statusdll();
frm_Stat.Show();
}
}
}
and the other file looks like this:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace kompDll
{
/// <summary>
/// Summary description for status.
/// </summary>
public class frm_Statusdll : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public frm_Statusdll()
{
//
// Required for Windows Form Designer support
//
InitializeComponent(); //AS SOON AS I PRESS STEP INTO ON THIS
LINE IN THE DEBUGGER, IT THROWS THE MISSINGMETHODEXCEPTION.
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(56, 72);
this.label1.Name = "label1";
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// label2
//
this.label2.Location = new System.Drawing.Point(56, 120);
this.label2.Name = "label2";
this.label2.TabIndex = 1;
this.label2.Text = "label2";
//
// frm_Statusdll
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "frm_Statusdll";
this.Text = "statusdll";
this.ResumeLayout(false);
}
#endregion
}
}
The point of all this is that i have to use the same code from more
different places, so instead of writing this a 100 times, i want it to be in
some kind of component that i can call.
Hope that you can help.