|
datagridview сохранить изменения в строке которую редактируешь
|
|||
---|---|---|---|
#18+
редактирую данные в dataGridview. Если курсор остается на редактируемой строке - то при нажатии на кнопку сохранить ничего не происходит (сообщение об ошибки не выходит, сохранение не происходит) private void toolStripButton1_Click(object sender, EventArgs e) { GridView_Currency.EndEdit(); DataSet ds = DataSet_Currency.GetChanges(); if (ds == null) return; try { this.currencyTableAdapter.Update(this.DataSet_Currency.Currency); } catch (Exception a) { MessageBox.Show(this, a.Message, "Error"); } } Если просто закрыть окно то процедура срабатывает правильно private void Form_Currency_FormClosing(object sender, FormClosingEventArgs e) { DataSet ds = DataSet_Currency.GetChanges(); if(ds == null) return; DialogResult res = MessageBox.Show("Сохранить изменения?", " ", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (res == System.Windows.Forms.DialogResult.Yes) { try { this.currencyTableAdapter.Update(this.DataSet_Currency.Currency); } catch (Exception a) { MessageBox.Show(this, a.Message, "Error"); } } if (res == System.Windows.Forms.DialogResult.Cancel) { e.Cancel = true; } } В чем ошибка??? Есть идея перевести вручную курсор на строку вверх, а потом вернуть обратно. Такое возможно ? или может какой метод прописать .... ... |
|||
:
Нравится:
Не нравится:
|
|||
25.09.2013, 07:47 |
|
|
start [/forum/topic.php?desktop=1&fid=20&tid=1403988]: |
0ms |
get settings: |
10ms |
get forum list: |
15ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
82ms |
get topic data: |
14ms |
get forum data: |
3ms |
get page messages: |
29ms |
get tp. blocked users: |
2ms |
others: | 330ms |
total: | 493ms |
0 / 0 |