Click here to Skip to main content
Click here to Skip to main content

Convertion of Xdock VB to CS by C-Sharpener For VB.

, 18 Sep 2007
Rate this:
Please Sign up or sign in to vote.
Convertion VB to CS by C-Sharpener For VB of the XDock projet

Introduction

This article speak about to translation of vb in c#

I have seen the good idea xDock.asp, and I want to have the same thing in C#
because originally the code is in VB dotnet.

Background

So I thinking in my self, it wil be no difficult to translate it , or to find a automatic translater.
I use http://labs.developerfusion.co.uk/convert/csharp-to-vb.aspx but there's a lot of thing it not translate and make error.

Public Sub Add(ByVal Item As IDockItem, Optional ByVal Key As String = Nothing, Optional ByVal Before As IDockItem = Nothing, Optional ByVal After As IDockItem = Nothing)

Is convert by :

public void Add(IDockItem Item, // ERROR: Unsupported modifier : In, Optional string Key, // ERROR: Unsupported modifier : In, Optional IDockItem Before, // ERROR: Unsupported modifier : In, Optional IDockItem After)


Information.IsNumeric(Value))

Is Convert by

Information.IsNumeric(Value)) -> But in CSharp there'snt IsNumeric..

Using C-Sharpener For VB


I have seen a translater vb to c# on the web site : http://www.elegancetech.com/ : C-Sharpener For VB

And they provide free translation for openSource project, so I ask to them if it's possible to translate XDock from VB to C#
So they give me a licence to do that.

I'll describe how the translator works and what kind of problem I have.

I integration in MSVC is good.
You must load your vb project and apply the translator C-Shaperer for VB.

Screenshot - img5.jpg

Screenshot - img4.jpg

Screenshot - img3.jpg

Screenshot - img2.jpg

Screenshot - img1.jpg

Screenshot - img6.jpg
After you have a report.

It's not magick, there're errors but it's not so hard to resolve.
The converter is really well embdded in msvc Express , and He create a project
in this case XDock_CS and convert le res file and the dependency.

For example , in file the IsNumeric if translated well , I never had problem with that.



The main difficulty is about the XDock file iniFile.vb , because in this code
the author don't strenght type of the objet in the ArryaList.
It could be a Key or a ArrayList.

But C# is less permicive than VB.
( I have some difficulty to understand )

So object is always object in c#, but in c# you have to cast this object in the good one you want to.

There's no information to know that then , the translater can find it.

( I guest in in VB the type could find at runtime )

I put in comment this line because I don't understand how to translate :

DockWindow.cs
//pSkinMenu = this.mnuSkins.MenuItems.Add( pDirectory.Name, new /* TRANSERROR: replace with correct delegate */ UnknownDelegate( ContextHandler ) );

So I delete some functionnality to have only the control moving with icon.
I share my work.

I was impressed by the product C-Sharpener For VB because I don't know anything about VB and I successfull in this task.
And the web converted is good for a simple translation, but this product translate all the project easily.

Thank's to

<a href="http://www.csharpenerforvb.com"><img src="convertedby.gif" alt="Converted from VB.NET to C# by C-Sharpener For VB"></a>
Roger Jack of
www.elegancetech.com

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

zebulon75018
Software Developer (Senior) http://www.cmb-soft.com/
France France
No Biography provided

Comments and Discussions

 
GeneralMy vote of 5 Pinmembermanoj kumar choubey26-Feb-12 21:13 
Questionhave c++ version? PinmemberMember 406720112-Mar-10 23:54 
GeneralMy vote of 1 PinmemberTimekeeperX29-Jan-09 23:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 18 Sep 2007
Article Copyright 2007 by zebulon75018
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid