Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
GeneralRe: Accessing Public Members of the Main Form from Another Form Pin
James T. Johnson25-Sep-02 16:02
James T. Johnson25-Sep-02 16:02 
GeneralRe: Accessing Public Members of the Main Form from Another Form Pin
David Stone26-Sep-02 10:23
sitebuilderDavid Stone26-Sep-02 10:23 
GeneralRe: Accessing Public Members of the Main Form from Another Form Pin
James T. Johnson26-Sep-02 12:02
James T. Johnson26-Sep-02 12:02 
GeneralRe: Accessing Public Members of the Main Form from Another Form Pin
Waleed Eissa25-Sep-02 12:36
Waleed Eissa25-Sep-02 12:36 
GeneralDetecting Enter in a Single-line Textbox Pin
Waleed Eissa25-Sep-02 11:30
Waleed Eissa25-Sep-02 11:30 
GeneralRe: Detecting Enter in a Single-line Textbox Pin
leppie25-Sep-02 12:16
leppie25-Sep-02 12:16 
GeneralRe: Detecting Enter in a Single-line Textbox Pin
Waleed Eissa25-Sep-02 12:33
Waleed Eissa25-Sep-02 12:33 
GeneralRe: Detecting Enter in a Single-line Textbox Pin
Paul Riley25-Sep-02 12:57
Paul Riley25-Sep-02 12:57 
Three things:

1) Keys.Enter and Keys.Return are two seperate things.

2) Do you have an AcceptButton set up for the form (what used to be called the Default Button)?
If so, you'll never get the KeyDown event, even the way leppie describes, because the AcceptButton's Click event is executed first.
If not, why don't you set up an AcceptButton? (go to the form's properties, find AcceptButton and drop down a list of buttons)

3) If you must and can use the KeyDown event, handle it, don't override it. eg.
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
	if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Enter)
	{
		// do whatever you want here
		e.Handled = true;
	}
}


Paul
GeneralRe: Detecting Enter in a Single-line Textbox Pin
leppie25-Sep-02 13:03
leppie25-Sep-02 13:03 
GeneralRe: Detecting Enter in a Single-line Textbox Pin
Waleed Eissa27-Sep-02 11:09
Waleed Eissa27-Sep-02 11:09 
GeneralRe: Detecting Enter in a Single-line Textbox Pin
Paul Riley27-Sep-02 12:32
Paul Riley27-Sep-02 12:32 
GeneralRe: Detecting Enter in a Single-line Textbox Pin
Waleed Eissa27-Sep-02 11:46
Waleed Eissa27-Sep-02 11:46 
GeneralRe: Detecting Enter in a Single-line Textbox Pin
Paul Riley27-Sep-02 12:48
Paul Riley27-Sep-02 12:48 
GeneralRe: Detecting Enter in a Single-line Textbox Pin
Anonymous27-Sep-02 13:04
Anonymous27-Sep-02 13:04 
GeneralRe: Detecting Enter in a Single-line Textbox Pin
Paul Riley27-Sep-02 13:15
Paul Riley27-Sep-02 13:15 
GeneralRe: Detecting Enter in a Single-line Textbox Pin
Waleed Eissa27-Sep-02 12:24
Waleed Eissa27-Sep-02 12:24 
GeneralRe: Detecting Enter in a Single-line Textbox Pin
Paul Riley27-Sep-02 12:54
Paul Riley27-Sep-02 12:54 
Questionhelp ? Pin
imran_rafique25-Sep-02 11:10
imran_rafique25-Sep-02 11:10 
AnswerRe: help ? Pin
leppie25-Sep-02 12:56
leppie25-Sep-02 12:56 
GeneralOpening Excel workbook Pin
Donald Blachly25-Sep-02 10:26
Donald Blachly25-Sep-02 10:26 
GeneralRe: Opening Excel workbook Pin
Stephane Rodriguez.25-Sep-02 21:11
Stephane Rodriguez.25-Sep-02 21:11 
GeneralRe: Opening Excel workbook Pin
Donald Blachly26-Sep-02 3:50
Donald Blachly26-Sep-02 3:50 
QuestionHow to activate event procedure Pin
D Shen25-Sep-02 9:42
D Shen25-Sep-02 9:42 
AnswerRe: How to activate event procedure Pin
leppie25-Sep-02 9:57
leppie25-Sep-02 9:57 
GeneralRe: How to activate event procedure Pin
D Shen25-Sep-02 10:51
D Shen25-Sep-02 10:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.