Solved

datagridview comboboxColumn event

Posted on 2008-10-10
3
760 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Put window Form inside tab page 10 33
Variable Event ? 3 29
i have to take the screenshot of command prompt? how to do this? 1 37
Winform Module - What is the ASP.Net equiv 2 23
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

803 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