By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,016 Members | 1,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,016 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
> 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 discussion thread is closed

Replies have been disabled for this discussion.