private void medupdate_Btnu_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(medprice_update.Text) && !string.IsNullOrEmpty(medtxt_update.Text)) { String name = medtxt_update.Text; int price = int.Parse(medprice_update.Text); medselected.med_name = name; medselected.med_price = price; hmsfac.updateMedicine(medselected); dataGrid_AllMedicines.Items.Refresh(); MessageBox.Show("Record update success!", "Success!", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("All fields are required.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } }