Solved

datagridview comboboxColumn event

Posted on 2008-10-10
3
758 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
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
jpaulino earned 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to change a specific bit from a file 2 29
VB.Net - CSV to Oracle table 4 51
Closing all open child forms. 4 38
Close tabpage of custom control 9 23
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

914 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now