Last active
April 27, 2016 19:21
-
-
Save decvalts/98feea440bf5b8e31496834c9e6c2e23 to your computer and use it in GitHub Desktop.
CAESAR-Lisflood error : An object reference is required for the non-static field, method, or property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // In Form2.cs, line 23 | |
| private void Form2_Leave(object sender, EventArgs e) | |
| { | |
| caesar1.Form1.checkBox2.Checked = false; | |
| } | |
| // Should be... | |
| private void Form2_Leave(object sender, EventArgs e) | |
| { | |
| caesar1.Form1 Frm1 = new caesar1.Form1(); | |
| Frm1.checkBox2.Checked = false; | |
| } | |
| // Similarly in ZoomPanImageBox.cs, line 164 | |
| private void clicky(object sender, MouseEventArgs e) | |
| { | |
| if (caesar1.Form1.checkBox2.Checked == true) | |
| { ... | |
| // Should be... | |
| private void clicky(object sender, MouseEventArgs e) | |
| { | |
| caesar1.Form1 Frm1 = new caesar1.Form1(); | |
| if (Frm1.checkBox2.Checked == true) | |
| { ... | |
| // Now fix the checkbox2 issue by making it static | |
| // line 1268 | |
| public static CheckBox checkBox2; | |
| // Now you have to make all the instances of this.checkbox2 into caesar1.Form1.checkbox2... | |
| // line 1720 | |
| caesar1.Form1.checkBox2 = new System.Windows.Forms.CheckBox(); | |
| // lines 5120 - 5128 | |
| caesar1.Form1.checkBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); | |
| caesar1.Form1.checkBox2.AutoSize = true; | |
| caesar1.Form1.checkBox2.Location = new System.Drawing.Point(407, 543); | |
| caesar1.Form1.checkBox2.Name = "checkBox2"; | |
| caesar1.Form1.checkBox2.Size = new System.Drawing.Size(108, 17); | |
| caesar1.Form1.checkBox2.TabIndex = 151; | |
| caesar1.Form1.checkBox2.Text = "point info window"; | |
| caesar1.Form1.checkBox2.UseVisualStyleBackColor = true; | |
| caesar1.Form1.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged); | |
| // line 5280 | |
| this.Controls.Add(caesar1.Form1.checkBox2); | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make all the this.checkBox2 into caesar1.Form1.checkbox2 seems to do the trick