private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if(this.ActiveMdiChild == null) return;
Form activeChild = this.ActiveMdiChild;
switch(this.ActiveMdiChild.Name)
{
case "recordEditor":
{
if(e.Button == this.tbSerarch)
{
recordEditor f = (recordEditor)activeChild;
f.search();
}
else if(e.Button == this.tbOpen)
{
if(this.editRecordDialog.ShowDialog() == DialogResult.OK)
{
try
{
recordEditor rf = new recordEditor(this,this.editRecordDialog.FileName,this.ActiveMdiChild.Text);
rf.MdiParent = this;
rf.Show();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
else if(e.Button == this.tbCopy)
{
try
{
recordEditor f = (recordEditor)activeChild;
f.copyRows();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
else if(e.Button == this.tbCut)
{
try
{
recordEditor f = (recordEditor)activeChild;
f.cutRows();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
else if(e.Button == this.tbPaste)
{
try
{
recordEditor f = (recordEditor)activeChild;
f.pasteRows();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
else if(e.Button == this.tbSave)
{
try
{
recordEditor f = (recordEditor)activeChild;
f.save();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}break;
}
}