i start my programm with a form called "mainWindow" in this form i have a button and this run a function that open a new form as object. my problem is i cant access a control on this object or a function on this object and i dont understand why
the first form:
public partial class mainWindow : Form
{
public mainWindow()
{
InitializeComponent();
this.drawDriverGrid();
}
public void drawDriverGrid()
{
Form driverGridForm = new driverGridView();
driverGridForm.GetSelected();
}
this is the second form
public partial class driverGridView : Form
{
public driverGridView()
{
InitializeComponent();
}
public int GetSelected()
{
return 1;
}
}
i cant run the GetSelected function
Formcalled driverGridForm, but your class is actually adriverGridView. If you want to access members of adriverGridViewthan your instance has to be of that type.MainWindow,DriverGridView