У меня есть 2 формы: Form1 и Form2. Я открыл Form2, используя:
Form2 newForm2 = new Form2(this);
А теперь я хочу получить доступ к некоторым переменным или методам из Form1, которые установлены публично, например: public int counter;
Но когда я пытаюсь сделать это из Form2, выдается ошибка:
Error 4 'System.Windows.Forms.Form' does not contain a definition for 'StartGame' and no extension method 'StartGame' accepting a first argument of type 'System.Windows.Forms.Form' could be found (are you missing a using directive or an assembly reference?)
Edit:
В форме 1:
Form2 newForm2 = new Form2(answer, button3, button4, button5, button6, this, fiftyfifty, web, change);
newForm2.Show();
В форме 2:
Form originalParent;
public Form2(int answer, Button button3, Button button4, Button button5, Button button6, Form parentform, int fiftyfifty, int web, int change)
{
InitializeComponent();
originalParent = parentform;
}
и я пытаюсь получить доступ к этому как originalParent."public Method here"
, и это дает мне эту ошибку.