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?
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros