private void frmArbeidsplan_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5) { MessageBox.Show("F5"); e.SuppressKeyPress = true; e.Handled = true; OppdaterSkjema(); } }
//Refresh skjema med data private void OppdaterSkjema() { if (this.lOG_ArbeidsplanDataGridView.IsCurrentCellInEditMode) { this.Validate(); this.lOG_ArbeidsplanDataGridView.EndEdit(); this.lOG_ArbeidsplanBindingSource.EndEdit(); this.lOG_ArbeidsplanTableAdapter.Update(this.dataSetApoLogiDose); } OppdaterStatus(0, 1, 5, "Fjerner objekter fra skjema"); Form.ControlCollection fObjs = (ControlCollection)this.Controls; int i = fObjs.Count; while (i != 0) { fObjs[0].Dispose(); i = i - 1; } this.InitializeComponent(); this.frmArbeidsplan_Load(sndr, es); OppdaterStatus(-1, 4, 5, "Siste lasting:" + DateTime.Now.ToLongTimeString()); }
InitializeComponent
Form
void onKeyPressEvent(object sender, KeyEventArgs e) { if(e.Handled) return; { // // the block of codes to be executed on the key press // should added here. // } e.Handled = true; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)