Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

DataGridView CurrentCell.EditType

Avatar of dgb
dgb asked on
.NET ProgrammingVisual Basic.NET
3 Comments1 Solution1942 ViewsLast Modified:
I want to know if the inline editor of my cell in a DataGridView is of the type DataGridViewTextBoxEditingControl.
I would like to know why I can't use this:

?CurrentCell.EditType Is DataGridViewTextBoxEditingControl
'DataGridViewTextBoxEditingControl' is a type and cannot be used as an expression.

The error message seems strange to me, because in an other piece of code I use something like this:

?TypeOf CurrentCell Is DataGridViewCell

As an alternative I have:

?CurrentCell.EditType Is (New DataGridViewTextBoxEditingControl).GetType

This probably will give me a lot of garabage collection.

I also could use this:

?CurrentCell.EditType.Name = "DataGridViewTextBoxEditingControl"

But I try to avoid this practice for obvious reasons (casing can change).

Why can I not use:

?CurrentCell.EditType Is DataGridViewTextBoxEditingControl

It seems like a good idea.

What should I use instead as best practice?