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

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

Minor design nitpick: If you find yourself with more than a handful of tabs, a tab control probably isn't the right way to display your data. I'd be more inclined to use a list box and a user control nested in a split container where selecting a month in the list box loads that month into the user control.

the best option would be what deceptikon has suggested.

for your problem, seems like the method call has some issues,
call dgv_CellContentClick(_tabname,sender,e);
instead of dgv_CellContentClick(_tabname,null,null);
lets see if this works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.