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

Setting focus to a combobox in a grid

P: n/a
Hello (again),

Within my datagrid I add a control to the datagridtextboxcolumn when
the underlying textbox receives focus as follows:

Combobox1.Size = New Size(Datagrid1.GetCurrentCellBounds().Width + 3,
combobox1.Size.Height)
sender.Controls.Add(Combobox1)

This works great. The problem is that when focus is set on the
combobox, and user presses the "down arrow" on the keyboard to scroll
to the next record, the combobox loses focus and focus is set behind
the combobox. I already have a BindingManagerBase to detect when user
scrolls to the next record. I try to set focus to the combobox in
there but without any success.

Is there a way to force focus to the combobox?

My thanks!

Mike.

Jul 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Mike,

I have seen this behaviour to in a creation of a combobox. But the problem
is, you have to make your combobox for a datagrid yourself or to get it
somewhere from internet. Those can be wrong, investigating in that is not so
usefull anymore. The DataGridView has an inbuild combobox.

This are the some on our website

http://www.vb-tips.com/dbPages.aspx?...6-7320e41e6d05

http://www.vb-tips.com/dbPages.aspx?...4-d5f9861ba534

http://www.vb-tips.com/dbPages.aspx?...9-3866d4936de0

I hope this helps,

Cor

<mf********@yahoo.caschreef in bericht
news:11**********************@p79g2000cwp.googlegr oups.com...
Hello (again),

Within my datagrid I add a control to the datagridtextboxcolumn when
the underlying textbox receives focus as follows:

Combobox1.Size = New Size(Datagrid1.GetCurrentCellBounds().Width + 3,
combobox1.Size.Height)
sender.Controls.Add(Combobox1)

This works great. The problem is that when focus is set on the
combobox, and user presses the "down arrow" on the keyboard to scroll
to the next record, the combobox loses focus and focus is set behind
the combobox. I already have a BindingManagerBase to detect when user
scrolls to the next record. I try to set focus to the combobox in
there but without any success.

Is there a way to force focus to the combobox?

My thanks!

Mike.

Jul 24 '06 #2

P: n/a
Hi Cor.

I have done some research as well before sending the message this
morning but all the comboboxes I found on the internet work fine if the
combobox style is a dropdownlist but if the style is dropdown, there
are many little glitches. The combobox in the grid also has to
autocomplete the text (ie. when user presses a letter on the keyboard,
the text in the combobox automatically fills with the first item which
starts with the letter pressed).

I'll look at the links you have provided and let you know.

Thanks for all the help. You have saved me many hours of work.

Cor Ligthert [MVP] wrote:
Mike,

I have seen this behaviour to in a creation of a combobox. But the problem
is, you have to make your combobox for a datagrid yourself or to get it
somewhere from internet. Those can be wrong, investigating in that is not so
usefull anymore. The DataGridView has an inbuild combobox.

This are the some on our website

http://www.vb-tips.com/dbPages.aspx?...6-7320e41e6d05

http://www.vb-tips.com/dbPages.aspx?...4-d5f9861ba534

http://www.vb-tips.com/dbPages.aspx?...9-3866d4936de0

I hope this helps,

Cor

<mf********@yahoo.caschreef in bericht
news:11**********************@p79g2000cwp.googlegr oups.com...
Hello (again),

Within my datagrid I add a control to the datagridtextboxcolumn when
the underlying textbox receives focus as follows:

Combobox1.Size = New Size(Datagrid1.GetCurrentCellBounds().Width + 3,
combobox1.Size.Height)
sender.Controls.Add(Combobox1)

This works great. The problem is that when focus is set on the
combobox, and user presses the "down arrow" on the keyboard to scroll
to the next record, the combobox loses focus and focus is set behind
the combobox. I already have a BindingManagerBase to detect when user
scrolls to the next record. I try to set focus to the combobox in
there but without any success.

Is there a way to force focus to the combobox?

My thanks!

Mike.
Jul 24 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.