Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default button hit in windows forms (trying to find the best solution)

The question is: How to make default button be focused on form focus and response on "Enter" hit, but not focused when the caret is in textbox with multiline property set to true for example?..I know that i can do some exceptions in code, but maybe there is some "best practices" i dont know for now :( thank you

like image 833
0x49D1 Avatar asked Jan 15 '09 09:01

0x49D1


People also ask

What is the default event of windows form?

The Form and Control classes expose a set of events related to application startup and shutdown. When a Windows Forms application starts, the startup events of the main form are raised in the following order: Control. HandleCreated.

What is the first control that you want to add to a Windows form when you want to use data in the application?

Step 1) The first step is to drag the 'radiobutton' control onto the Windows Form from the toolbox as shown below. Step 2) Once the Radiobutton has been added, go to the properties window by clicking on the Radiobutton control.

What Windows form controls?

Windows Forms controls are reusable components that encapsulate user interface functionality and are used in client-side, Windows-based applications. Not only does Windows Forms provide many ready-to-use controls, it also provides the infrastructure for developing your own controls.

How do I add a button to Windows form?

Add the control by drawingSelect the control by clicking on it. In your form, drag-select a region. The control will be placed to fit the size of the region you selected.


1 Answers

Maybe I got you wrong, but what I would do is:

  1. Set the "AcceptButton" of the form to the Button you want to respond on "Enter"
  2. Set the "AcceptsReturn" of the textbox with multiline to true

et voila

like image 180
Xn0vv3r Avatar answered Sep 30 '22 14:09

Xn0vv3r