I am new to C #. I am trying to show a new form (form2) when I click a button in form1.
this is my code.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace SliceEngine { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button5_Click(object sender, EventArgs e) { Form2 form2 = new Form2(); form2.ShowDialog(); } } }
error shows
the type or namespace name 'Form2' cannot be found (did you miss the use directive or assembly reference?)
this is my code for form2.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace SliceEngine { public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void Form2_Load(object sender, EventArgs e) { } } }
for form2, I'm just doing an interface design.
all that I know when using Java, I only need to declare an object first. What should I do for this?
source share