public partial class toolbar : UserControl { public delegate void ItemClickedEventHandler(System.Object sender, ItemClickEventArgs e); public toolbar() { InitializeComponent(); inf = new IAToolBar.infocore(); } public event ItemClickedEventHandler ItemClicked; public class ItemClickEventArgs { public string flag; public ItemClickEventArgs(string flg) { flag = flg; } } private void btnsave_Click(object sender, EventArgs e) { if (ItemClicked != null) { ItemClicked(sender, new ItemClickEventArgs("Save")); } } }
public void Insert(System.Windows.Forms.Form f) { connection.Open(); try { query = "INSERT INTO " + f.Tag.ToString().Trim() + " (" + queryfields + ") VALUES (" + formvalues + ") "; MySqlCommand cmd = new MySqlCommand(query, connection); cmd.ExecuteNonQuery(); MessageBox.Show("Save Sucessfully", "Inventory Accountancy", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "Inventory Accountancy", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { connection.Close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)