subclass datagrid control

  • Thread starter Thread starter Alex Feldman
  • Start date Start date
A

Alex Feldman

I wanted to subclass the DataGrid control to add functionality (that
should have been there in the first place). I have followed
instructions, similar to the ones in the following link that teach how
to subclass controls,

http://support.microsoft.com/default.aspx?scid=kb;en-us;311317

but once I replace the control initialization statements to initialize
to my subclass, the grid disapears from the designer. I guess I can
live with it since If I want to get it back I can uncomment the original
grid initialization if I want to edit the grid from the designer, and
then change the initialization back to a subclass when I'm done, but
isn't there a better way? I tried making the subclass a control
selectable from the toolbox, but it's greyed out when I add it. I
couldn't find a set of good instructions on how to get that to work.

If anyone has good instructions on how to subclass a DataGrid and make
it a selectable control from the toolbox, or just any other suggestion
how I can solve the problem described above I would greatly appreciate it.

Alex Feldman
 
Thanks Tim.

All of these examples seem to do a lot of drawing of the control. Do I
have to implement my own OnPaint code, or any other display
functionality? I was thinking of inheriting from the DataGrid control,
so can't I just let the DataGrid do the painting?

Thanks.

Alex
 
Do I have to implement my own OnPaint code,
or any other display functionality?
No. You should just be able to derive straight from the DataGrid class. The
important thing to note is that you need two assemblies - one for runtime
and one for design-time. The design-time assembly is usually built by hand
(command line, batch file). The assemblies are "linked" through VS using the
RuntimeAssemblyAttribute.
I was thinking of inheriting from the DataGrid control,
so can't I just let the DataGrid do the painting?
Yep.
 
Thanks Tim.

I am trying to run the batch file to do the build, and I get the
following errors:

========Batch file=========
vbc /netcf /define:NETCFDESIGNTIME /target:library
/out:design.DataGridPlus.dll DataGridPlus.vb /r:"C:\Program
Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK
\v1.0.5000\Windows CE\Designer\System.CF.Design.dll" /r:"C:\Program
Files\Microsoft Visual Studio .NET
2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.dll" /r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Drawing.dll" /r:System.Windows.Forms.dll
/r:System.Drawing.dll /r:System.dll /r:System.XML.dll /r:
System.Web.Services.dll /r:System.Data.dll
========Batch file=========

Microsoft (R) Visual Basic .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322.2032
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.

vbc : error BC30249: Project-level conditional compilation constant
'NETCFDESIGN
TIME' is not valid: '=' expected.
C:\[ProgramPath]\DataGridPlus.vb(34) : error BC30284: sub 'OnMouseDown'
cannot be declared 'Overrides' because it does not override a sub in a
base class.

Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)
~~~~~~~~~~~

C:\[ProgramPath]\DataGridPlus.vb(34) : warning BC40003: sub
'OnMouseDown' shadows an overloadable member declared in the base class
'DataGrid'. If you want to overload the base method, this method must
be declared 'Overloads'.

Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)
~~~~~~~~~~~

C:\Data\Bartech
Software\PocketBartLite\PBLiteSolution\CustomControls\DataGridPl
us.vb(34) : error BC30560: 'MouseEventArgs' is ambiguous in the
namespace 'Syste
m.Windows.Forms'.

Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)

(--OTHER ERRORS FOLLOW, BUT THEY'RE THE SAME AS ABOVE)
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~


What am I doing wrong? I tried doing just an override overload, or just
an overload, but still got errors. The override worked just fine when I
was subclassing within my application. Also, I based the .BAT file on
the C# compiler example, so I modified it the best I can, but I'm not
sure that it's 100% right.

Thanks for the help.

Alex
 
Building a design-time control is currently only supported using the C#
compiler in version 1.0 of the CF. I believe that the general idea is that
the VB compiler throws errors/warnings that can't be suppressed during a
"design-time build", whereas the C# compiler can suppress these
errors/warnings. The alternative at this point is to not have a design-time
version of your control, instead create it manually through code, or you'll
need to restructure your code in the C# language.

--
Tim Wilson
..Net Compact Framework MVP

Alex Feldman said:
Thanks Tim.

I am trying to run the batch file to do the build, and I get the
following errors:

========Batch file=========
vbc /netcf /define:NETCFDESIGNTIME /target:library
/out:design.DataGridPlus.dll DataGridPlus.vb /r:"C:\Program
Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK
\v1.0.5000\Windows CE\Designer\System.CF.Design.dll" /r:"C:\Program
Files\Microsoft Visual Studio .NET
2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.dll" /r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Drawing.dll" /r:System.Windows.Forms.dll
/r:System.Drawing.dll /r:System.dll /r:System.XML.dll /r:
System.Web.Services.dll /r:System.Data.dll
========Batch file=========

Microsoft (R) Visual Basic .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322.2032
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.

vbc : error BC30249: Project-level conditional compilation constant
'NETCFDESIGN
TIME' is not valid: '=' expected.
C:\[ProgramPath]\DataGridPlus.vb(34) : error BC30284: sub 'OnMouseDown'
cannot be declared 'Overrides' because it does not override a sub in a
base class.

Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)
~~~~~~~~~~~

C:\[ProgramPath]\DataGridPlus.vb(34) : warning BC40003: sub
'OnMouseDown' shadows an overloadable member declared in the base class
'DataGrid'. If you want to overload the base method, this method must
be declared 'Overloads'.

Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)
~~~~~~~~~~~

C:\Data\Bartech
Software\PocketBartLite\PBLiteSolution\CustomControls\DataGridPl
us.vb(34) : error BC30560: 'MouseEventArgs' is ambiguous in the
namespace 'Syste
m.Windows.Forms'.

Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)

(--OTHER ERRORS FOLLOW, BUT THEY'RE THE SAME AS ABOVE)
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~


What am I doing wrong? I tried doing just an override overload, or just
an overload, but still got errors. The override worked just fine when I
was subclassing within my application. Also, I based the .BAT file on
the C# compiler example, so I modified it the best I can, but I'm not
sure that it's 100% right.

Thanks for the help.

Alex

Tim said:
No. You should just be able to derive straight from the DataGrid class. The
important thing to note is that you need two assemblies - one for runtime
and one for design-time. The design-time assembly is usually built by hand
(command line, batch file). The assemblies are "linked" through VS using the
RuntimeAssemblyAttribute.



Yep.
 
Thanks Tim!

When you say "restructure your code", do you mean just the custom
control code? If it's just the custom control code that needs to be in
C# while the application using the control can be in VB.NET that's not a
problem for me. Rewriting the application that would use this control
to be in C# however is not an option.

Thanks again!

Alex
 
When you say "restructure your code", do you
mean just the custom control code? Yes.

If it's just the custom control code that needs to
be in C# while the application using the control can
be in VB.NET that's not a problem for me. Rewriting
the application that would use this control to be in C#
however is not an option.
Only the custom control would need to be rewritten in C#. You can consume
this control, even through the designer, with a VB.Net project.
 
Well, I've got the code in C#, and it compiled in the DOS prompt OK, and
I've got the 2 dll files that I copy to their appropriate locations.
However, when I add the customized DataGrid control to the toolbox it is
greyed out. I've checked the references in both projects (custom
control and user of control), and there doesn't seem to be anything
missing (as far as I can tell anyway). Do you have any suggestions? I
think I'm almost there!

Thanks.

Alex4
 
A couple things that come to mind... Are you sure that you properly included
the RuntimeAssemblyAttribute? Are you sure that you properly built the
design-time assembly against the CF designer assemblies and the desktop
assemblies? When you added the control to the ToolBox did you browse to the
design-time assembly?
 
Thanks Sergey,

I've looked at your thread before. I was actually missing the

/r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.DataGrid.DLL"

line in my .bat file. I just added it and recompiled. The control is
still greyed out :-(

Alex


Sergey said:
See this thread:
http://groups-beta.google.com/group...1f00541f8d9/dc888fb9ea756bce#dc888fb9ea756bce


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Alex said:
Well, I've got the code in C#, and it compiled in the DOS prompt OK,
and I've got the 2 dll files that I copy to their appropriate
locations. However, when I add the customized DataGrid control to the
toolbox it is greyed out. I've checked the references in both
projects (custom control and user of control), and there doesn't seem
to be anything missing (as far as I can tell anyway). Do you have any
suggestions? I think I'm almost there!

Thanks.

Alex4
 
I added your source (AssemblyInfo.cs and DataGridPlus.cs) to a new class
library project and built it to produce the CustomControls.dll runtime
output. Then I modified the batch file as shown below...

csc /noconfig /define:NETCFDESIGNTIME /target:library
/out:design.CustomControls.dll AssemblyInfo.cs DataGridPlus.cs
/r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Design.dll" /r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.dll" /r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.DataGrid.dll" /r:"C:\Program
Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Drawing.dll" /r:System.Windows.Forms.dll
/r:System.Drawing.dll /r:System.dll /nowarn:1595

copy /y design.CustomControls.dll "C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\Designer"

copy /y bin\debug\CustomControls.dll "C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE"

Then I added the control to the ToolBox by navigating to the design-time
version (design.CustomControls.dll). The control appears in the ToolBox as
it should, I could drag and drop it onto the Form, and the associated
runtime assembly was automatically added as a reference.
 
You have missed AssemblyInfo.cs and System.CF.Drawing.dll. Try this command:

csc /noconfig /define:NETCFDESIGNTIME /target:library
/out:design.CustomControls.dll DataGridPlus.cs AssemblyInfo.cs
/r:"C:\Program Files\Microsoft Visual Studio .NET
2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Design.dll" /r:"C:\Program Files\Microsoft Visual
Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.dll" /r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Drawing.dll" /r:"C:\Program Files\Microsoft Visual
Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.DataGrid.DLL" /r:System.Drawing.dll
/r:System.Windows.Forms.dll /r:System.dll /r:System.XML.dll
/r:System.Data.dll /nowarn:1595


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Alex said:
I'm attaching the revised project, with the .bat file modified.
Alex


Thanks Sergey,

I've looked at your thread before. I was actually missing the

/r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.DataGrid.DLL"

line in my .bat file. I just added it and recompiled. The control is
still greyed out :-(

Alex


Sergey said:
See this thread:
http://groups-beta.google.com/group...1f00541f8d9/dc888fb9ea756bce#dc888fb9ea756bce


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Alex Feldman wrote:


Well, I've got the code in C#, and it compiled in the DOS prompt OK,
and I've got the 2 dll files that I copy to their appropriate
locations. However, when I add the customized DataGrid control to the
toolbox it is greyed out. I've checked the references in both
projects (custom control and user of control), and there doesn't seem
to be anything missing (as far as I can tell anyway). Do you have any
suggestions? I think I'm almost there!

Thanks.

Alex4

Tim Wilson wrote:


When you say "restructure your code", do you
mean just the custom control code?



Yes.



If it's just the custom control code that needs to
be in C# while the application using the control can
be in VB.NET that's not a problem for me. Rewriting
the application that would use this control to be in C#
however is not an option.



Only the custom control would need to be rewritten in C#. You can
consume
this control, even through the designer, with a VB.Net project.
 
Well, to kind of answer my own question, I can add the new grid to the
form, and delete the old one. Then I rename the new grid to the old
one's name. Lastly, I can add the
Me.dgGridName.TableStyles.Add(Me.DataGridTableStyle1) to the
"DataGridName" section of InitializeComponent method, and all the column
configuration is saved that way. If anyone has a better way I'd love to
hear it :-)

Alex

Alex said:
ALRIGHT!

Got it working. I made a few small changes to the .bat file. I also had a
reference to the namespace containing the custom control in my application,
and I removed that as well. After recompiling that time everything
worked!. I am attaching the project to this email so that if anyone wants
to use it in the future they have a quick project to start from. I believe
that many different custom controls can be added to this project and
compiled with the .bat file (although I haven't tested it out).

Quick question though....what's the easiest way to subsitute my new custom
grid in place of the existing grids on my form? When I try to substitude
the declaration and initialization from the standard to my custom one in
code the control dissapeared from the designer. I can add a new one and
reconfigure it the way I did the originals, but is there a way to
substitute?

Thanks for the help Tim,
Spasibo Sergey.

Alex

I'm attaching the revised project, with the .bat file modified.
Alex


Thanks Sergey,

I've looked at your thread before. I was actually missing the

/r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.DataGrid.DLL"

line in my .bat file. I just added it and recompiled. The control is
still greyed out :-(

Alex


Sergey Bogdanov wrote:

See this thread:
http://groups-beta.google.com/group...1f00541f8d9/dc888fb9ea756bce#dc888fb9ea756bce


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Alex Feldman wrote:


Well, I've got the code in C#, and it compiled in the DOS prompt OK,
and I've got the 2 dll files that I copy to their appropriate
locations. However, when I add the customized DataGrid control to the
toolbox it is greyed out. I've checked the references in both
projects (custom control and user of control), and there doesn't seem
to be anything missing (as far as I can tell anyway). Do you have any
suggestions? I think I'm almost there!

Thanks.

Alex4

Tim Wilson wrote:


When you say "restructure your code", do you
mean just the custom control code?



Yes.



If it's just the custom control code that needs to
be in C# while the application using the control can
be in VB.NET that's not a problem for me. Rewriting
the application that would use this control to be in C#
however is not an option.



Only the custom control would need to be rewritten in C#. You can
consume
this control, even through the designer, with a VB.Net project.
 
Once the reference to your CustomControls.dll has been added to the project,
you can then just search and replace "System.Windows.Forms.DataGrid" with
the fully qualified name of your custom DataGrid "<namespace>.<classname>".
That should allow you to do substitution.

--
Tim Wilson
..Net Compact Framework MVP

Alex Feldman said:
ALRIGHT!

Got it working. I made a few small changes to the .bat file. I also had a
reference to the namespace containing the custom control in my application,
and I removed that as well. After recompiling that time everything
worked!. I am attaching the project to this email so that if anyone wants
to use it in the future they have a quick project to start from. I believe
that many different custom controls can be added to this project and
compiled with the .bat file (although I haven't tested it out).

Quick question though....what's the easiest way to subsitute my new custom
grid in place of the existing grids on my form? When I try to substitude
the declaration and initialization from the standard to my custom one in
code the control dissapeared from the designer. I can add a new one and
reconfigure it the way I did the originals, but is there a way to
substitute?

Thanks for the help Tim,
Spasibo Sergey.

Alex

Alex Feldman said:
I'm attaching the revised project, with the .bat file modified.
Alex


Alex Feldman said:
Thanks Sergey,

I've looked at your thread before. I was actually missing the

/r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.DataGrid.DLL"

line in my .bat file. I just added it and recompiled. The control is
still greyed out :-(

Alex


Sergey Bogdanov wrote:
See this thread:
http://groups-beta.google.com/group...1f00541f8d9/dc888fb9ea756bce#dc888fb9ea756bce


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Alex Feldman wrote:

Well, I've got the code in C#, and it compiled in the DOS prompt OK,
and I've got the 2 dll files that I copy to their appropriate
locations. However, when I add the customized DataGrid control to the
toolbox it is greyed out. I've checked the references in both
projects (custom control and user of control), and there doesn't seem
to be anything missing (as far as I can tell anyway). Do you have any
suggestions? I think I'm almost there!

Thanks.

Alex4

Tim Wilson wrote:

When you say "restructure your code", do you
mean just the custom control code?



Yes.


If it's just the custom control code that needs to
be in C# while the application using the control can
be in VB.NET that's not a problem for me. Rewriting
the application that would use this control to be in C#
however is not an option.



Only the custom control would need to be rewritten in C#. You can
consume
this control, even through the designer, with a VB.Net project.
 
I should clarify that you should probably allow the CustomControls.dll
(runtime) reference to be added automatically by dragging and dropping an
instance of your custom DataGrid from the ToolBox. That way the appropriate
design-time reference will be added to the project file as well. Then you
can just delete that instance that you just added. So you're basically using
VS to set up the references for you by dropping your control onto the form
through the designer. After that then you can go into the source and search
and replace like I mentioned. Since you're deriving from the DataGrid,
everything that you have done through the designer against the CF DataGrid
will be able to be done against your custom DataGrid.

--
Tim Wilson
..Net Compact Framework MVP

Tim Wilson said:
Once the reference to your CustomControls.dll has been added to the project,
you can then just search and replace "System.Windows.Forms.DataGrid" with
the fully qualified name of your custom DataGrid
That should allow you to do substitution.

--
Tim Wilson
.Net Compact Framework MVP

Alex Feldman said:
ALRIGHT!

Got it working. I made a few small changes to the .bat file. I also
had
a
reference to the namespace containing the custom control in my application,
and I removed that as well. After recompiling that time everything
worked!. I am attaching the project to this email so that if anyone wants
to use it in the future they have a quick project to start from. I believe
that many different custom controls can be added to this project and
compiled with the .bat file (although I haven't tested it out).

Quick question though....what's the easiest way to subsitute my new custom
grid in place of the existing grids on my form? When I try to substitude
the declaration and initialization from the standard to my custom one in
code the control dissapeared from the designer. I can add a new one and
reconfigure it the way I did the originals, but is there a way to
substitute?

Thanks for the help Tim,
Spasibo Sergey.

Alex
http://groups-beta.google.com/group...1f00541f8d9/dc888fb9ea756bce#dc888fb9ea756bce
--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Alex Feldman wrote:

Well, I've got the code in C#, and it compiled in the DOS prompt OK,
and I've got the 2 dll files that I copy to their appropriate
locations. However, when I add the customized DataGrid control to the
toolbox it is greyed out. I've checked the references in both
projects (custom control and user of control), and there doesn't seem
to be anything missing (as far as I can tell anyway). Do you have any
suggestions? I think I'm almost there!

Thanks.

Alex4

Tim Wilson wrote:

When you say "restructure your code", do you
mean just the custom control code?



Yes.


If it's just the custom control code that needs to
be in C# while the application using the control can
be in VB.NET that's not a problem for me. Rewriting
the application that would use this control to be in C#
however is not an option.



Only the custom control would need to be rewritten in C#. You can
consume
this control, even through the designer, with a VB.Net project.
 
Thanks a lost Tim. For some complicated reason, your simple solution of
doing a search/replace is much better than mine :-) I did it and it worked
great. Saved me lots of time.

I also tested and updated/fixed up my custom grid. I'll attach the modified
..cs file for anyone who might want it.

Thanks for everything guys.

Alex


Tim Wilson said:
I should clarify that you should probably allow the CustomControls.dll
(runtime) reference to be added automatically by dragging and dropping an
instance of your custom DataGrid from the ToolBox. That way the
appropriate
design-time reference will be added to the project file as well. Then you
can just delete that instance that you just added. So you're basically
using
VS to set up the references for you by dropping your control onto the form
through the designer. After that then you can go into the source and
search
and replace like I mentioned. Since you're deriving from the DataGrid,
everything that you have done through the designer against the CF DataGrid
will be able to be done against your custom DataGrid.

--
Tim Wilson
.Net Compact Framework MVP

Tim Wilson said:
Once the reference to your CustomControls.dll has been added to the project,
you can then just search and replace "System.Windows.Forms.DataGrid" with
the fully qualified name of your custom DataGrid
That should allow you to do substitution.

--
Tim Wilson
.Net Compact Framework MVP

Alex Feldman said:
ALRIGHT!

Got it working. I made a few small changes to the .bat file. I also
had
a
reference to the namespace containing the custom control in my application,
and I removed that as well. After recompiling that time everything
worked!. I am attaching the project to this email so that if anyone wants
to use it in the future they have a quick project to start from. I believe
that many different custom controls can be added to this project and
compiled with the .bat file (although I haven't tested it out).

Quick question though....what's the easiest way to subsitute my new custom
grid in place of the existing grids on my form? When I try to substitude
the declaration and initialization from the standard to my custom one
in
code the control dissapeared from the designer. I can add a new one
and
reconfigure it the way I did the originals, but is there a way to
substitute?

Thanks for the help Tim,
Spasibo Sergey.

Alex

I'm attaching the revised project, with the .bat file modified.
Alex


Thanks Sergey,

I've looked at your thread before. I was actually missing the

/r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.DataGrid.DLL"

line in my .bat file. I just added it and recompiled. The control is
still greyed out :-(

Alex


Sergey Bogdanov wrote:
See this thread:
http://groups-beta.google.com/group...1f00541f8d9/dc888fb9ea756bce#dc888fb9ea756bce
--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Alex Feldman wrote:

Well, I've got the code in C#, and it compiled in the DOS prompt OK,
and I've got the 2 dll files that I copy to their appropriate
locations. However, when I add the customized DataGrid control to the
toolbox it is greyed out. I've checked the references in both
projects (custom control and user of control), and there doesn't seem
to be anything missing (as far as I can tell anyway). Do you have any
suggestions? I think I'm almost there!

Thanks.

Alex4

Tim Wilson wrote:

When you say "restructure your code", do you
mean just the custom control code?



Yes.


If it's just the custom control code that needs to
be in C# while the application using the control can
be in VB.NET that's not a problem for me. Rewriting
the application that would use this control to be in C#
however is not an option.



Only the custom control would need to be rewritten in C#. You can
consume
this control, even through the designer, with a VB.Net project.
 
Back
Top