Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

datagridview comboboxColumn event

Posted on 2008-10-10
3
Medium Priority
?
770 Views
Last Modified: 2010-04-21
Hello Experts,

I have a datagridview with a ComboBoxColumn and I would like to display a dialog depending on the selection from the ComboBoxColumn.  Is there a similar event like ComboBox.SelectedIndexChanged for the datagridview ComboBoxColumn?

Thank You In Advance

Mutu
0
Comment
Question by:mutu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 1000 total points
ID: 22689943
You have to define a DataGridViewComboBoxEditingControl
Check this example and make the necessary adjustments:

    Private WithEvents dgvCombo As DataGridViewComboBoxEditingControl
      
    Private Sub dgvCombo_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
      
        If dgvCombo Is Nothing Then Exit Sub
            
        ' The column of the combobox
        If Me.DataGridView1.CurrentCell.ColumnIndex = 4 Then
      
              You code
      
        End If
    End Sub
      
    Private Sub DataGridView1_CellLeave(ByVal sender As Object, _
            ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellLeave
        dgvCombo = Nothing
    End Sub
      
      
    Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object, _
            ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) _
            Handles DataGridView1.EditingControlShowing
      
        If TypeOf e.Control Is DataGridViewComboBoxEditingControl Then
      
            If dgvCombo Is Nothing Then
                dgvCombo = e.Control
            End If
      
            AddHandler dgvCombo.SelectedIndexChanged, _
                       New EventHandler(AddressOf dgvCombo_SelectedIndexChanged)
           End If
    End Sub
      

Open in new window

0
 
LVL 48

Expert Comment

by:jpaulino
ID: 22689951
'  You code
is
' Your code :)
0
 

Author Closing Comment

by:mutu
ID: 31505151
Thank You!!!

I copied, pasted and modified names and voila!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question