si2030
asked on
Clear a datagridviewcombobox cell when you mouse click on it.
Hi Experts,
I have a datagridview with the first column being set as a combobox editable column.
I want to click on the cell and clear its contents.
I am using the mouse click event... started below.
How do I automatically clear the contents of this datagridviewcombobox cell when I click on it?
It may already have details selected... I want any click of the mouse on that cell to clear it ready for a new selection. The selection will be via keyboard entry...
Simon
I have a datagridview with the first column being set as a combobox editable column.
I want to click on the cell and clear its contents.
I am using the mouse click event... started below.
How do I automatically clear the contents of this datagridviewcombobox cell when I click on it?
It may already have details selected... I want any click of the mouse on that cell to clear it ready for a new selection. The selection will be via keyboard entry...
Simon
Private Sub DataGridView1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseUp
Dim hti As DataGridView.HitTestInfo = DataGridView1.HitTest(e.X, e.Y)
Try
Dim testx = hti.ColumnIndex
Dim testy = hti.RowIndex
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER