Click here to Skip to main content
15,881,938 members
Articles / Operating Systems / Windows
Article

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

Rate me:
Please Sign up or sign in to vote.
2.56/5 (5 votes)
18 Sep 20073 min read 29.6K   286   10   3
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


Written By
Software Developer (Senior) http://www.cmb-soft.com/
France France
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Manoj Kumar Choubey26-Feb-12 21:13
professionalManoj Kumar Choubey26-Feb-12 21:13 
Questionhave c++ version? Pin
Member 406720112-Mar-10 23:54
Member 406720112-Mar-10 23:54 
GeneralMy vote of 1 Pin
TimekeeperX29-Jan-09 23:24
TimekeeperX29-Jan-09 23:24 

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

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