Jump to content

Combobox em Datagridview


Seabra
 Share

Recommended Posts

Olá,

Com o código que mostro em baixo pretendo que apareça uma combobox numa Datagridview.

A combobox aparece mas corretamente mas quando mudo de célula, a combobox não desaparece da célula anterior.

Qual é a forma de apagar a combobox da célula aonterior?

Cumprimentos

Private Sub DataGridView1_CellClick(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        Dim comboBoxCell As New DataGridViewComboBoxCell

        comboBoxCell.Items.Add("1")
        comboBoxCell.Items.Add("2")
        comboBoxCell.Items.Add("3")

        Me.DataGridView1(DataGridView1.CurrentCell.ColumnIndex, DataGridView1.CurrentCell.RowIndex) = comboBoxCell


    End Sub
Link to comment
Share on other sites

Boas

No evento .CellLeave mete isto:

Dim TextBoxCell As New DataGridViewTextBoxCell
Try
     Me.DataGridView1(DataGridView1.CurrentCell.ColumnIndex, DataGridView1.CurrentCell.RowIndex) = TextBoxCell
Catch
End Try

A informática chegou para resolver problemas que antes não existiam

Quem ri por último é porque está conectado a 52 Kbs.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.