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

comboboxcolumn in datagridview

Hi
I am having issues with a combobox column in a datagridview with virtual
mode enabled. I am binding data to both the datagrid and combobox from
an sql database. Everything works fine however when I select an item in
the combobox and move onto the next row, the item dissapears from the
combobox and it moves back to a blank state. I have put a break point
at: (and it fires off when I click the drop down on the combobox). Can
anyone suggest a solution.

Private Sub DataGridView1_EditingControlShowing(ByVal sender As
System.Object, ByVal e As DataGridViewEditingControlShowingEventArgs)
Handles DataGridView1.EditingControlShowing

Dim editingComboBox As ComboBox = CType(e.Control, ComboBox)
AddHandler editingComboBox.SelectedIndexChanged, AddressOf
Me.editingComboBox_SelectedIndexChanged

End Sub
Jun 7 '06 #1
1 1711
> Hi
I am having issues with a combobox column in a datagridview with
virtual
mode enabled. I am binding data to both the datagrid and combobox from
an sql database. Everything works fine however when I select an item
in
the combobox and move onto the next row, the item dissapears from the
combobox and it moves back to a blank state. I have put a break point
at: (and it fires off when I click the drop down on the combobox). Can
anyone suggest a solution.
Private Sub DataGridView1_EditingControlShowing(ByVal sender As
System.Object, ByVal e As DataGridViewEditingControlShowingEventArgs)
Handles DataGridView1.EditingControlShowing

Dim editingComboBox As ComboBox = CType(e.Control, ComboBox)
AddHandler editingComboBox.SelectedIndexChanged, AddressOf
Me.editingComboBox_SelectedIndexChanged
End Sub


Where do you remove the handler for the combobox. I suspect that you are
adding another handler when you move to the next row and not removing the
handler from the last row, thus both are now handling the same event. Since
the new row is cleared, it is telling the old row to clear itself. In my
case, I have just used the native DataGridViewComboBoxColumn and let the
standard binding take control. This means that my object is not updated until
the cell changes focus, but I have resigned myself to that situation at this
point.

FWIW, I did run into a problem with disposing the form when the combo box's
datasource was still bound. I put a solution up at http://devauthority.com/blogs/jwoole...12/02/638.aspx.

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
Jun 8 '06 #2

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

Similar topics

1
by: news.microsoft.com | last post by:
Hello, I've got a "simple" problem with the datagridview in VS2005. I am trying to use a unbound datagridview with a ComboBoxColumn. The datagridview with the ComboBoxColumn is configurered at...
4
by: Matt | last post by:
I have been searching all over the web for a way to sort a DataGridView based on the actual text being shown in a ComboBox column as opposed to the underlying value (an ID in this case). Can anyone...
2
by: Bill nguyen | last post by:
I need help to set selected value of combobox column in DGV. I went this far then got stuck on what to do next:. How do I set "selected Value" of comboboxpayCode to value of column PayCode ?...
0
by: Gerrit | last post by:
Hello, I have searched with Google for hours, but I cannot find a good solution for sorting a Datagridview on a comboboxcolumn and than sorted on the displaymember instead of the value member. ...
2
by: giminera | last post by:
I have a datagrid with three columns: the first is a combobox, the second one and the third one are textboxcolumns. The comboboxcolumn have as datasource a dataset from a sql table that have three...
8
by: Brian Pelton | last post by:
This is on .Net 2.0 in a WinForms application. I have a DataGridView that is bound to a BindingSource. The DataGridView has 3 columns. The first two are "normal" text columns and the last is a...
3
by: DominicHelen | last post by:
I made a windows application with c#. I have a datagridview with two DatagridviewComboBoxColumn, Category and subCategory both of these two columns get their drop down list with...
0
by: Dharmaraju | last post by:
I have added datagridview combobox column with datagridview . I want to write a code for combobox events .Please give a suggestions
0
by: Andrus | last post by:
I tried to use modeless picklist for DataGridView custom ComboBoxColumn without success. Steps to reproduce issue: 1. Run code 2. Enter some character 3. Press Tab Observed:
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...
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
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...
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.