473,809 Members | 2,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_E ditingControlSh owing(ByVal sender As
System.Object, ByVal e As DataGridViewEdi tingControlShow ingEventArgs)
Handles DataGridView1.E ditingControlSh owing

Dim editingComboBox As ComboBox = CType(e.Control , ComboBox)
AddHandler editingComboBox .SelectedIndexC hanged, AddressOf
Me.editingCombo Box_SelectedInd exChanged

End Sub
Jun 7 '06 #1
1 1727
> 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_E ditingControlSh owing(ByVal sender As
System.Object, ByVal e As DataGridViewEdi tingControlShow ingEventArgs)
Handles DataGridView1.E ditingControlSh owing

Dim editingComboBox As ComboBox = CType(e.Control , ComboBox)
AddHandler editingComboBox .SelectedIndexC hanged, AddressOf
Me.editingCombo Box_SelectedInd exChanged
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 DataGridViewCom boBoxColumn 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
3822
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 Design time. How Do I access the "combobox" at runtime to change list members in the combobox. Thanks Kjell
4
8647
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 tell me if this is even possible, and if so, how to do it? If this is completely impossible, how would you suggest going about sorting a ComboBox wherein the text displayed in the column is the client's name, and the underlying value is an ID? ...
2
16159
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 ? That is earningCode = payCode. I can't find .selectedValue in DatagridView ComboboxColumn . Thanks Bill
0
1179
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. I found that it must be possible, but not how. So I hope you can help me with a suggestion, a link or a sample. Thanks, Gerrit
2
1076
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 fields: item,descr,qty. When I choose a field in the combobox I'd like the values in the two textboxcolumns is the value of descr and qty connected to combobox value (like a binding). Thanks.
8
11538
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 combo box column. Data binding is working fine for the first two columns. I am able to edit values and persist them back to the bound object and ultimately back to the database.
3
3179
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 Column.Items.Add(,.....). I did not use databinding since my user need to type free text which is not in the list . Now I need to let user click on Category column and to get corresponding subCategory list. I know there is some discusstion on <Link Removed>. But I...
0
917
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
2065
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
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10643
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10121
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.