G
Guest
I'm currently creating a custom column in a DataGridView. I'm wondering if
Generics can be used to solve an issue I'm seeing.
When creating the editing control for the column cell I have the code:
class MyEditingControl : MyTextBox, IDataGridViewEditingControl
{ ... } (The control is currently working just fine.)
The column class is defined like this:
class MySpecialColumn : DataGridViewColumn
{ ... }
If I could cause "MyTextBox" to be seen as a generic <T> then I could pass
in a <T> generic to the column when it is created and added to the
DataGridView. This would allow me to add multiple columns but using
different "cell" types in my code. If this is possible can someone show me
how the code should look when defining such a thing?
I'm looking for something like this for the control:
class MyEditingControl<T> : T, IDataGridViewEditingControl
{ ... }
I'm looking for something like this when defining the column to be placed
into the DataGridView.
class MySpecialColumn<T> where T : Class : DataGridViewColumn
{...}
If this is possible does anyone know how?
Generics can be used to solve an issue I'm seeing.
When creating the editing control for the column cell I have the code:
class MyEditingControl : MyTextBox, IDataGridViewEditingControl
{ ... } (The control is currently working just fine.)
The column class is defined like this:
class MySpecialColumn : DataGridViewColumn
{ ... }
If I could cause "MyTextBox" to be seen as a generic <T> then I could pass
in a <T> generic to the column when it is created and added to the
DataGridView. This would allow me to add multiple columns but using
different "cell" types in my code. If this is possible can someone show me
how the code should look when defining such a thing?
I'm looking for something like this for the control:
class MyEditingControl<T> : T, IDataGridViewEditingControl
{ ... }
I'm looking for something like this when defining the column to be placed
into the DataGridView.
class MySpecialColumn<T> where T : Class : DataGridViewColumn
{...}
If this is possible does anyone know how?