コード例 #1
0
        private void addemployee(object sender, RoutedEventArgs e)
        {
            DataRow    newRow     = dt.NewRow();
            EditWindow editWindow = new EditWindow(newRow);

            editWindow.ShowDialog();

            if (editWindow.DialogResult.Value)
            {
                dt.Rows.Add(editWindow.resultRow);
                adapter.Update(dt);
            }
        }
コード例 #2
0
        private void changeemployee(object sender, RoutedEventArgs e)
        {
            DataRowView newRow = (DataRowView)employeeDataGrid.SelectedItem;

            newRow.BeginEdit();

            EditWindow editWindow = new EditWindow(newRow.Row);

            editWindow.ShowDialog();

            if (editWindow.DialogResult.HasValue && editWindow.DialogResult.Value)
            {
                newRow.EndEdit();
                adapter.Update(dt);
            }
            else
            {
                newRow.CancelEdit();
            }
        }