Hi All
I have to forms (frmMain & frmEditMonth).
frmMain has a tabControl on the 12 tabs (1 for each month) and a datagridview showning the days and the times and hours worked
frmEditMonth (used as a edit Dialog pop-up) allows the user to edit the hours worked
what i need to is pass information from DatagridView called dgv_xxx (where xxx is the name of the tab, Jan/Feb/Mar etc).
over to the frmEditMonth and populate it's comboboxes
here is the problem
i bring in the name of the tab as a string, when passing this over, I get a "overload method" as i can convert the string to a DataGridView
// run monthly data (jan-Feb)
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
string _tabname = tabControl1.SelectedTab.Name;
switch (tabControl1.SelectedTab.Name)
{
default:
{
dgv_CellContentClick(_tabname,null,null);
// here is the error message
// The best overloaded method match for 'FlexRecorder.frmMain.dgv_CellContentClick(System.Windows.Forms.DataGridView, object, System.Windows.Forms.DataGridViewCellEventArgs)' has some invalid arguments
}
break;
}
}
// on click of DatagridView pass information form this.datgriview to frmEditMonth and populate its comboboxes
private void dgv_CellContentClick(DataGridView _tabName,object sender, DataGridViewCellEventArgs e)
{
frmEditMonth frm = new frmEditMonth();
if (e.RowIndex >= 0)
{
DataGridView tabname = _tabName;
DataGridViewRow row = tabname.Rows[e.RowIndex];
frm.cboDayType.Text = row.Cells["DayType"].Value.ToString();
frm.cboDayStart.Text = row.Cells["DayStart"].Value.ToString();
frm.cboLunch.Text = row.Cells["Lunch"].Value.ToString();
frm.cboDayEnd.Text = row.Cells["DayEnd"].Value.ToString();
frm.tboNotes.Text = row.Cells["Notes"].Value.ToString();
}
frm.ShowDialog();
frm.Dispose();
}
}
thanks in advance for all and any help