private void NameTextBoxLeave(object sender, EventArgs e) { if (NameTextBox.Text.Length > 0) { GroupFileDialog.FileName = NameTextBox.Text + ".xml"; BrowseButton.Focus(); } }
private void Box_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Enter: Apply(); e.SuppressKeyPress = true; break; case Keys.Escape: Varor.Select(); if (Varor.Items.Count > 0 && Varor.SelectedItems.Count <= 0) { Varor.Items[0].Selected = true; } e.SuppressKeyPress = true; break; case Keys.Up: case Keys.Down: for (int i = 0; i < textBoxes.Length; i++) { if (textBoxes[i].Focused) { if (e.KeyCode == Keys.Up) { if (i != 0) { textBoxes[i - 1].Focus(); } else { ApplyButton.Focus(); } } else { if (i != 2) { textBoxes[i + 1].Focus(); } else { BrowseButton.Focus(); } } break; } } break; } }