How to use C# class in VB

M

Mike

Here are steps (put together by MS support) on how to use Alex Feinman's C#
code to set alternating colors on DataGrid rows in VB. The same method can
be used for other C# classes.

1. Start VS.NET and click New Project.
2. In the left tree select Visual C# Projects. In the right pane, select
Smart Device Applications. Click OK.
3. In the Smart Device Application Wizard, choose Pocket PC as the platform
and select Class Library as project type. Click OK. The new project will be
created.
4. Copy file GridEvenOddHandler.cs to the newly created project folder.
5. In the Solution Explorer, right click the project name
"SmartDeviceApplication1" and select Add / Add Existing Item.
6. Click on GridEvenOddHandler and click open button. Thus we add the C#
code to the class library.
7. Select Project / Add Reference from the main menu.
8. Add references to System.Drawing, System.Windows.Forms,
System.Windows.Forms.DataGrid, and click OK. The C# code use classes in
these namespaces, while these assemblies are not referenced by default. So
we have to add them manually.
9. Rebuild the solution, and now, the new DLL can be comsumed by other
Smart Device Applications.
 
B

Brian H

Can you not just include multiple projects in the same solution? (IE, a C#
classes project that contains these classes, and a VB.NET front end...)
I've done this in the VS.NET for the desktop framework. The VB.NET would
just have a reference to the project.

Seems like it would be easier to maintain if they were in the same
solution...

-Brian
 
C

Chris Tacke, eMVP

Yes, you can. It will still generate a separate DLL, but they can all be in
the same solution.

-Chris
 
E

Enrico Bizzarri

Hi,
I've builded the dll. Now how i use it?

Plz speak easy i'm total new to .Net world.

TIA

Enrico
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top