Value null was found where an instance of an object was required
-
I am going to try this again. I have a dll which I can call in VB6 with no problem. I am trying to convert all my code to c# but I am running into a big problem with accessing dlls'. The first time I posted this question no one could answer why I was getting the error, so I will ask what is the error exactly. I have researched all the wox books, microsoft and cannot find out what this error actually means to give me a starting point for my resolution. Here is my code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Runtime.InteropServices; using System.Diagnostics; namespace WindowsApplication20 { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { [DllImport("Mydll.dll")] public static extern int myOpen(string sFileName); private System.Windows.Forms.Button button1; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Label label1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.textBox1 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.textBox2 = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(32, 88); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(408, 20); this.textBox1.TabIndex = 1; this.textBox1.Text = "textBox1"; // // button1 // this.button1.Lo