473,404 Members | 2,137 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,404 software developers and data experts.

Setting focus to a combobox in a grid

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
2 3123
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bryan Masephol | last post by:
Hi All I got a datagrid and a ComboBox on a form. I populate the combobox with years for all the data avaiable. When the user chooses a year the datagrid is populated with the specific years...
0
by: Shravan | last post by:
Hi, I have a Windows Forms Custom DataGrid, which is put in a usercontrol, which on setting DataSource is setting focus to grid. The call stack for setting the focus is as follows. This is not...
2
by: Bill C. | last post by:
Hi, I'm trying to implement a ComboBox drop-down column for a DataGrid. When a cell is selected in the ComboBox column I overlay a ComboBox over the cell and call: this.comboBox.Show();...
2
by: Mystery Man | last post by:
We have an MDI application that is not setting always setting focus to the newly corrected MDI. It is creating the form and it is the topmost but it does not have focus. The code we are using to...
0
by: liki | last post by:
i have 3 text box TxtFirstName,TxtMiddleName,t3 and 1 ComboBox cmbStatus i have written code in TxtFirstName keypress event,key down event for get the focus in TxtMiddleName by pressing Enter. But...
1
by: Praveena.Alapati | last post by:
Hi, There is a tab control on a page with multiple tabs and handful of controls in each tab. The way it's rendered in html (like grid etc..) is in table format in tablerows and cells. On...
3
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
3
by: Simon | last post by:
Dear reader, On the event "Lost focus" I make the ComboBox invisible but the massage pops up "You can't hide a control that has the focus." But this code is written in the "Lost focus"...
3
by: Andrus | last post by:
I have DataGridView in virtual mode containing 3500 rows. In code below, assigning to RowCount value to 3500 takes 8 seconds. CPU usage goes high at this time. Stepping by F11 into user code shows...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.