473,396 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can't seem to get AcceptButton working when changed in code?

Hi,

I have a search for where we want the user to enter the search criteria in
at the top and press enter, then the results are shown in a datagrid which we
set the focus to. Once they select the item they want to choose then they
press enter to accept the form.

The problem is when you go into the form butSearch is set to AcceptButton
for the form, once you have selected the search criteria to populate the data
grid then we want to make butOK the AcceptButton for the form.

The butOK does have the highlight round it to say its the default button but
once you set it in code you can't even click on it with the mouse?

Anyone got any ideas?
Thanks
Mike
May 18 '06 #1
2 1636
sonicm wrote:
Hi,

I have a search for where we want the user to enter the search criteria in
at the top and press enter, then the results are shown in a datagrid which we
set the focus to. Once they select the item they want to choose then they
press enter to accept the form.

The problem is when you go into the form butSearch is set to AcceptButton
for the form, once you have selected the search criteria to populate the data
grid then we want to make butOK the AcceptButton for the form.

The butOK does have the highlight round it to say its the default button but
once you set it in code you can't even click on it with the mouse?

Anyone got any ideas?
Thanks
Mike

Just a suggestion:

Don't have any acceptbutton.
If the user is in the search box, keypress 13 ( <ENTER> ) causes the
search, as well as clicking the search button.
If the user is in the grid, keypress 13 causes accept action, as well as
clicking the accept button.

Tom
May 18 '06 #2
> Just a suggestion:

Don't have any acceptbutton.
If the user is in the search box, keypress 13 ( <ENTER> ) causes the
search, as well as clicking the search button.
If the user is in the grid, keypress 13 causes accept action, as well as
clicking the accept button.

Tom


Yeah I did think of that but thought I'd try to use the AcceptButton as its
neater. Looks like a bug in .NET 2003 then. Ok i'll use they keypress instead.

Thanks for your help
Mike
May 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kevin Smith | last post by:
I ran across a problem after installing the .NET framework Service Pack 1 on both XP and Server 2003, so I thought I would post the solution here in case anyone else ran across it. After...
2
by: lostdreamz | last post by:
Ok, my situation is like this. I have a form with a few text boxes each with a 'validating' event, OK & Cancel buttons, and have the AcceptButton/CancelButton/DialogResult properties all set. ...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
1
by: Jeff | last post by:
Hello all. I'm trying to figure out exactly what is going on here. I'm getting different results on different forms, and it's driving me nuts. For example, I have a form called FormFinish....
1
by: Alien2_51 | last post by:
I have a form with it's AcceptButton property set to a button on my forms click event, when I hit enter in runtime on the form, the cursor goes to an hourglass for a second, as if it were doing...
0
by: Karsten Sosna | last post by:
Hello NG, i have a problem with the AcceptButton in VB.Net and C#. I have an empty project with one form. On this form i take two buttons(Button1 and Button2). Now i set the the...
1
by: Al Biheiri | last post by:
how do i create an AcceptButton in c# user presses enter on textbox = button1.click something like AcceptButton = button1
1
by: Tony Johansson | last post by:
Hello! I'm reading a book which mentioned about this AcceptButton property for a form which seems quite easy so I try to figure out how it works but I have run into some small problems. I...
3
by: Josh Kodroff | last post by:
I have a pretty standard Windows Form with 2 relevant buttons: btnOK and btnCancel. I set both buttons' DialogResult properties appropriately. I then set the form AcceptButton and CancelButton...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.