Questions tagged [acceptbutton]

The AcceptButton along with the CancelButton are Form Properties that work only with buttons in C# Visual Studio. When these Form Properties are set, pressing enter or escape causes the click event to be executed.

.NET framework 4.6 api doc

35 questions
1
vote
1 answer

C# How to escape form's Accept Button from getting triggered

I have a Windows Form, with a ListView and a TextBox placed right on top of it. Also there is a button named 'Submit' on the Form with AcceptButton set to true. Now, my requirement is that, whenever I load the form and hit Enter, Submit button gets…
pradeepradyumna
  • 952
  • 13
  • 34
1
vote
3 answers

Setting AcceptButton to None still closes the form on ENTER

I have a MDI windows forms application and my child forms mostly have "OK" and "Cancel" buttons. However I do not want them to be activated with ENTER/ESC keys to prevent accidental saves/aborts. So, the form has both AcceptButton and CancelButton…
Vilx-
  • 104,512
  • 87
  • 279
  • 422
1
vote
5 answers

C#: Trouble with Form.AcceptButton

I have a form with an button which is set as the AcceptButton of the form. The form has several other controls. Now when I press Enter on other controls the form gets closed because of the accept button on the form. Same goes for CancelButton. How…
dattebayo
  • 2,012
  • 4
  • 30
  • 40
1
vote
1 answer

AcceptsReturn equivalent for WebBrowser .NET control

I have a Windows .NET application and one of the forms has a WebBrowser control, an OK button and a Cancel button. The WebBrowser control hosts a TextArea html element, so I can write inside. If the OK button is the form's AcceptButton…
Vasile Tomoiaga
  • 1,727
  • 3
  • 16
  • 19
1
vote
1 answer

Accept Button and Data Binding inconsistency

It is convenient to have an "Accept Button" (in WPF: IsDefault="True") on a Form. In the Windows Forms world, I used to read the data from the UI to the object(s) in the corresponding Click event of the button. But with WPF, data binding ought to be…
Bernhard Hiller
  • 2,163
  • 2
  • 18
  • 33
0
votes
1 answer

How do i easily find the Accept button and the cancel button on a WPF View

I have my PRISM application set up on a MVP pattern and we display modal windows through custom RegionManager. The problem i face right now is when the users close the Modal Window using an Alt+F4! The View closes but the Cancel button logic is…
ioWint
  • 1,609
  • 3
  • 16
  • 34
0
votes
1 answer

AcceptButton doesn't work in case there are TabControl on the form

In the following form, I want the AcceptButton to be OK button, but although I set the property to the Form that OK button is the accept button, the actual result is Test button. How to fix it?
French Boy
  • 1,471
  • 3
  • 18
  • 23
0
votes
1 answer

WinForms Button: draw as the default button without setting the form's AcceptButton property (custom drawing, IsDefault property, BS_DEFPUSHBUTTON)

Imagine the following construction in WinForms .NET. A WinForms form contains a custom control with several buttons, which are instances of the traditional Button class. One of these buttons is the default button for the form. The custom control…
TecMan
  • 2,743
  • 2
  • 30
  • 64
0
votes
1 answer

The Enter Key does not close a Form if the Focus is on a Button that is not the AcceptButton

I have a modal Form with three Buttons, A B and C. In addition, I have two Buttons: OK and Cancel. The OK Button's DialogResult property is set to DialogResult.OK and the Cancel Button DialogResult.Cancel. The Form's AcceptButton and CancelButton…
user11354125
0
votes
3 answers

Is the Windows Forms AcceptButton behavior in effect when the referenced button is disabled?

With the following: this.AcceptButton = this.OKButton; this.OKButton.Enabled = false; ... will the OK button click handler still be invoked when the user presses Enter?
Aidan Ryan
  • 11,389
  • 13
  • 54
  • 86
0
votes
3 answers

The Enter button not working on Login page

I just made a login system but I can only login with pressing the button on my screen, not using the enter button on my keyboard. How can I enable this? I read something about the AcceptButton, but how do I apply this? my code: login.php
MvanOeffel
  • 19
  • 1
  • 11
0
votes
1 answer

Winforms Default Button

I'm working on a form that has two main buttons, "OK" and "Cancel". I have set the "Accept Button" property of the form to be the "OK" button. Goal: I would like the "OK" button to be default, so that when the form is opened the "OK" button is…
Becca
  • 23
  • 1
  • 3
0
votes
1 answer

My Form is not registering Enter key presses

I am writing an educational program. I have a button which I want to be "clicked" when the user presses enter. I have set the form's accept button property to true and the KeyPreview property is also set to true. I have tried creating a custom Sub…
0
votes
1 answer

Click Enter in TextBoxes for Runnig Button in Winrt?

How can I do that; Click Enter in TextBoxes for Runnig Button in Winrt? I remember that textbox's AcceptReturn property doing it but for doing it we were changing forms' AcceptButton property in System.Forms but there is no property named…
Tugrul Emre Atalay
  • 918
  • 1
  • 9
  • 28
0
votes
0 answers

Accept Button and Cancel Button in a Panel in Windows Forms .NET

I am working in Windows Forms. I have a Form which has two panels. Both panels have OK and Cancel buttons. I want them to behave as Accept and Cancel button (Similar to Form's AcceptButton and CancelButton), for their respective panel(container). So…
Brij
  • 11,731
  • 22
  • 78
  • 116