Avatar of si2030
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
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

Open in new window

Visual Basic.NET

Avatar of undefined
Last Comment
si2030

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
VBRocks

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
si2030

ASKER
Thanks.
Your help has saved me hundreds of hours of internet surfing.
fblack61