Home All Groups Group Topic Archive Search About

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

Author
18 May 2006 1:35 PM
sonicm
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

Author
18 May 2006 4:44 PM
tomb
sonicm wrote:

Show quoteHide quote
>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
Author
19 May 2006 7:49 AM
sonicm
> 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