Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a desk band or Converting C# to VB.NET 3

Status
Not open for further replies.

tommyboyau

Programmer
Feb 7, 2005
47
AU
Hi Guys,
I want to create a desk band, sort of like the google toolbar.
However, the only code I can find is in C#.

The full program in C# can be found here:

I don't know c# so the question i'm asking is: Can someone either point me in the direction of the same thing in VB.Net or convert this to VB.Net for me?

Thanks,

Tom
 
Did you able to convert the code?

________________________________________
Zameer Abdulla
Visit Me
Minds are like parachutes. They only function when they are open. -Sir James Dewar (1877-1925)
 
Zmr,
I'm having a little trouble but i'm trying.
I'm a bit confused by the program itself but I will see how I go. I was going to wait a few days and hopefully tell you that I was sucessful, however, I might just repost if I have problems :)

Thanks for the links!

Tom
 
Tommy,

a few months ago, I managed to delete all my working .vb files in an aspx application.

What I found (that solved my probmes) was a couple of Decompliers that enabled me to point to my .dll and then gave me the choice of langage to decompile to..
vb c# etc.. (I did an amazing job and put me back on track)

If I am correct this link should get you there.

Very cool and lets me know how basic my knowledge is when otehr people can do this!

If you compile the cSharp app, you could then use the reflector to decompile to vb..

HTH

Rob
 
Rob,
Thanks for that link!
I will have a look at that in the next few days too! What a great idea.

Thanks for your assistance.

Tom.
 
Thanks for the links Zameer! Here are a few things to be aware of when using them.

A. Neither of them take into account the fact that VB.Net is NOT case sensitive so module level variables will conflict with property names due to the only difference being capitalization. Prefix module level names with m or m_ and change corresponding properties to use module level variables instead of Me.PropertyName.
Code:
Private name As String
   
Public ReadOnly Property Name() As String
   Get
      Return Me.name
   End Get
End Property
should be something like this
Code:
Private mName As String
   
Public ReadOnly Property Name() As String
   Get
      Return mName
   End Get
End Property

1. See A above
2. MultiLine comments have an additional CrLf which needs to be removed
Code:
/* Example
 * Line2
 * Line3
/*
translates to
Code:
' Example
'
 * Line2
'
 * Line3
'
instead of
Code:
'Example
'* Line2
'* Line3
'
3. Leading left curly brace { after NameSpace converts to _
4. Incorrectly converts auto commenting
Code:
/// <summary>
/// Summary description for Options.
/// </summary>
translates to (note leading space at beginning of first line only)
Code:
 '/ <summary>
'/ Summary description for Options.
'/ </summary>
instead of
Code:
''' <summary>
''' Summary description for Options.
''' </summary>

1. See A above
2. Does not create module level variables correctly
Code:
readonly string name;
translates to
Code:
ReadOnly name As String
instead of
Code:
Private name As String
3. Does NOT handle auto comments at all (eg /// Comment) - causes error page
4. Checking for Try/Catch so FileEntry becomes FileEnTry
5. Does not translate constructor properly
Code:
public Class1(string name)
translates to
Code:
Private Function Class1(ByVal name As String) As Public
instead of
Code:
Public Sub New(ByVal name As String)
Hopefully this will help someone out somewhere along the line...

Have a great day!

j2consulting@yahoo.com
 
Thanks SBendBuckeye, I am still new to VB.NET with little knowledge of VB(A). Still can't understand the differences in deep.

________________________________________
Zameer Abdulla
Visit Me
If you have never been hated by your child, you have never been a parent.
 
Hello Zameer,

Basically you can ignore most of them for now. The first link is the better link. Here is what you need to watch out for the most. C# is case sensitive so it will convert something like this:
Code:
Private myProperty As String

Public Property MyProperty As String
   Get
      Return myProperty
   End Get
   Set(value As String)
      myProperty = value
   End Set
End Property
Since VB.Net is NOT case sensitive, you will get a compile error saying that you have duplicate definitions for MyProperty. This is due to the Propery and module level variable being named MyProperty and myProperty respectively. What you need to do is change the private module level variable myProperty to m_myProperty or something like that. As soon as you change one of them so they are no longer the same, you will be able to compile cleanly. Good Luck!



Have a great day!

j2consulting@yahoo.com
 
Hello all,

I have a code which is in C# and have to convert it into ASP.NET. Does any one have any web site which would take care of this.

Thanks,

Vasu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top