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.
Questions tagged [acceptbutton]
35 questions
24
votes
5 answers
c# AcceptButton and validation
Hi
I have a form which contains of several textboxes and two buttons Cancel and Ok. These buttons are assigned to accept and cancel buttons properties in form. The problem is that I have to validate texts entered in all textboxes.
I want to do that…

exMode
- 241
- 1
- 3
- 4
8
votes
1 answer
Analogue of AcceptButton property in WPF window class?
The Form class of windows forms has the AcceptButton property, which allows certain button to be clicked when a user press Enter. Does the Window class of WPF has similar feature?

Louis Rhys
- 34,517
- 56
- 153
- 221
6
votes
4 answers
C# Validate before leaving accept_button event
Excuse me if this is a silly question but i'm a beginer here.
I have a simply custom dialog with two buttons: Accept and Cancel. The Accept button is the acceptButton of the form.
I want to do some validations on the Accept_Click event and decide if…

DkAngelito
- 1,147
- 1
- 13
- 30
3
votes
2 answers
How can i customize the button if it set a AcceptButton of the form?
I have implemented the custom button control with some additional options. And added my custom button into the form. When i set the Form.Acception is the added custom button, then I want to do some customization in the Button. I want to customize…

Jagadeesan
- 233
- 1
- 13
3
votes
1 answer
AcceptButton won't close form
I have two forms that are very similar, but in one of them clicking the AcceptButton closes the form, and in the other it doesn't close the form. Both of them have their AcceptButton set to btnAccept.
I recently created the second one, the first one…

Jeff B
- 8,572
- 17
- 61
- 140
3
votes
2 answers
Accept Button doesn't work
I have a problem with the accept-button inside a Windows Form.
The Form contains two buttons (OK and Cancel). Inside the Form I set the properties of the cancel and accept - Button to the specific buttons.
In addition to that I also created a…

user3887184
- 43
- 1
- 5
3
votes
2 answers
Approve/Reject in email generated by SharePoint
When I make a meeting in Outlook, the recipient gets a approve/reject button in the top of the email. I'd like to do a similar thing with SharePoint: when a task is created, an email is sent to the person the task is assigned to, and the email asks…

niklassaers
- 8,480
- 20
- 99
- 146
2
votes
5 answers
Windows Form Cancel Button Not Working
I have a Visual Studio, Visual Basic form that includes an OK button and a Cancel button.
What I want to do is have the OK button save the options that the user chooses and of course the Cancel button discarding them and returning them to their…

Paul Williams
- 1,554
- 7
- 40
- 75
2
votes
2 answers
Check if Cursor is in groupBox1 or groupBox2 C#
i have 2 groupBoxes, both with one TextBox and one Button.
When i am in groupBox1 and write something in textBox1 and i Press the Enter Button, the Button in groupBox1 should be pushed, same Thing when i am in groupBox2 and write something there in…

steffen1994
- 247
- 2
- 12
2
votes
1 answer
How to add accept/decline button in mail in laravel
I am doing a project. In this project I want that the provider may able to accept or decline someone's serial who give him serial from mail. But I am stuck in this. i can't be able to do so. Please help me solving this.
My mail function is

Jahid Mahmud
- 1,136
- 1
- 12
- 32
2
votes
2 answers
Making an AcceptButton border invisible
I am working on a project that is using a Victorian look and feel:
The problem that I'm having is with the AcceptButton (or OK or default acceptance) button. Obviously, I can make the button transparent and I can set the borders to 0 width. The…

zetar
- 1,225
- 2
- 20
- 45
2
votes
0 answers
Why AcceptButton is being called twice?
Edit: As Rob said, I asked the question again, with new and correct title here.
I have a form with CancelButton and AcceptButton (named btnCancel and btnOK). And I have some ComboBoxes as input fields.
ComboBoxes prevent my AcceptButton and…

h.nodehi
- 1,036
- 1
- 17
- 32
2
votes
5 answers
.NET UserControl accept button best practice?
I have a windows forms app where I have split different functionality into several user controls. I want each of these user controls to have an accept button.
Any best practices here?
My idèa is to detect which user control that has focus, and than…

Ezombort
- 1,892
- 3
- 16
- 20
1
vote
2 answers
Key Preview and Accept Button
Using winforms, I have set the KeyPreview property to true and have event handles for the proper key events within the base form as well.
Within the forms that inherit from it, I set the AcceptButton property based on the requirements of the…

user90279
- 65
- 7
1
vote
1 answer
How to prevent the form of being closed when AcceptButton is pressed in C#
I have a Form which has an “Ok” Button that is assigned as AcceptButton. When I click this Button or press Enter key the Form is automatically closed, as expected.
Under the event OkButtonClick I wrote a routine to check if all the fields were…

Fabiano Augusto
- 71
- 1
- 6