/// <summary> /// click event for food log button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnFoodLog_Click(object sender, EventArgs e) { //call form's constructor and assign variable MyFoodItemForm foodLog = new MyFoodItemForm(); //display Food Log form foodLog.ShowDialog(); }
/// <summary> /// click event to add a new food item /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddFoodItem_Click(object sender, EventArgs e) { //call form's constructor and assign variable MyFoodItemForm addFoodItem = new MyFoodItemForm(); //display Food Log form addFoodItem.ShowDialog(); //clear list box to make room for new list lstBoxFoodItems.Items.Clear(); //call loadFoods method again to refesh list box LoadFoods(); }