/// <summary> /// on click edit button the following event will call /// in this method value will be edited and updated. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button1_Click(object sender, EventArgs e) { string text = _lstShow.GetItemText(_lstShow.SelectedItem); string[] fields = text.Split('\t'); foodlist.RemoveAt(_lstShow.SelectedIndex); secondForm otherForm = new secondForm(); otherForm.Show(); secondForm form2 = (secondForm)Application.OpenForms["secondForm"]; form2.FoodName = fields[0]; form2.FoodType = fields[1]; }
/// <summary> /// when user click on order in menuitem then the second window will appear /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OrderToolStripMenuItem_Click(object sender, EventArgs e) { Form otherForm = new secondForm(); //declaring object of second form otherForm.Show(); }