VisualStudio2010 convert project C# to Vb.net ....damned solution!


Author Message
Wodka40°

Posted: 11/4/2011
Quote message 

Problem : Artsteer 3 export code work fine to asp.net but only for C#!
BUT i need to work in vb.net... and vb.net under Visual Studio 2010!.....prrrrrrrrrr!!!! Errors...!!!DOH!
think.....think.....

Solution:

Step 1)

New project
->Web
->VB.net
-> FW 3.5 (or lower)

Conversion code? Use this
http://www.developerfusion.com/tools/convert/csharp-to-vb/

step 2)
In Article and Block class

It may not immediately find ContainerControlDesigner!
If you wrap it .... you must goes explicitly imported namespace System.Design !!!
Project Properties -> References System.Design will declare as Net 2.0 version)

step 3)
The damned namespace of the vb.net project ....
if you leave it blank to make a C#-like notation not work! ...
So .... in the project properties panel application
Assembly Name: webmartek1 (for example)
Namespace root: webmartek (for example)

step 4) The terrible "vb.net inherits "
Example of user control creation header

<%@ Control Language="vb" AutoEventWireup="false" CodeFile="DefaultMenu.ascx.vb" Inherits="DefaultMenu" %>

THIS WORK but by default VB.net insert tak like this
Inherits="Webmartek.DefaultMenu"
NOT CORRECT NOT WORK
correct to same (SAME) name of usercontrol!
NOT OKAY .... just "DefaultMenu"
In C # we can also write "foobar" in VB.net..... NO! should usually be the name of the control .... I do not know why ... abhors more!
Designer vb.net declare
Partial Public Class DefaultMenu
End Class
In C# name is free to declare...in vb.net apparently no! Fix to name of usercontrol! BAH!

step 5) The incredible "bonton" of VB.net!!!
Register usercontrol in page
In c#
<%@ Import Namespace="Artisteer" %>
<%@ Register TagPrefix="artisteer" Namespace="Artisteer" %>

TRANSLATE TO VB.Net ....
<%@ Import Namespace="webmartek.Artisteer" %>
<%@ Register TagPrefix="artisteer" Assembly="webmartek1" Namespace="webmartek.Artisteer" %>

Namespace Artisteer not work....because Artisteer is child of root Namespace (i.e. webmartek)

but not over

user control Vb.net do not know where they are until i set the container Assembly! ...absurd formalism !!!! and i MUST use tag ASSEMBLY to set assembly that contains my usercontrol!!!!!
so

<%@ Register TagPrefix="artisteer" Assembly="webmartek1" Namespace="webmartek.Artisteer" %>

:-@

We shuffle around at the end. Our artisteer page is finally working in vb.net

i.e.


<%@ Page Language="VB" MasterPageFile="~/design/MasterPage.master" ValidateRequest="false" AutoEventWireup="true" CodeFile="Sito.aspx.vb" Inherits="Sito" Title="Untitled Page" %>

<%@ Import Namespace="webmartek.Artisteer" %>
<%@ Register TagPrefix="artisteer" Assembly="webmartek1" Namespace="webmartek.Artisteer" %>
<%@ Register TagPrefix="art" TagName="DefaultMenu" Src="DefaultMenu.ascx" %>
<%@ Register TagPrefix="art" TagName="DefaultHeader" Src="DefaultHeader.ascx" %>
<%@ Register TagPrefix="art" TagName="DefaultSidebar1" Src="DefaultSidebar1.ascx" %>


<asp:Content ID="PageTitle" ContentPlaceHolderID="TitleContentPlaceHolder" Runat="Server">
Page title here...
</asp:Content>

....bla bla bla.....

:-( :-( 8-) :-( :-(

Comments on this imho unnecessary verbosity vb.net (or an excessive conciseness of C #.... up to you) I leave them to others!

p.s.
Sorry for my "Inglish"
For italians post in italian language on newsgroup it.comp.lang.visual-basic...use google groups to find it!!!

 
sdim

Posted: 5/17/2012
Quote message 

C# is case sensitive, VB is not.

When you write C# code, "artisteer" is different than "Artisteer".

However, when you write VB code "artisteer" and "Artisteer" are the same.

Try to rename the variables and namespaces on your VB project.

 
tomicrow

Posted: 9/21/2012
Quote message 

Quote sdim:

C# is case sensitive, VB is not.

When you write C# code, "artisteer" is different than "Artisteer".

However, when you write VB code "artisteer" and "Artisteer" are the same.

Try to rename the variables and namespaces on your VB project.



You can covert your code using some online converter websites, or you study vb.net directly and convert your code. If you know C# it is very easy to study vb.net. Please check this website http://cshrp.net-informations.com the same website has another version http://vb.net-informations.com , so you can study side by side vb.net and c#.

Tmi.

 
Jose Manuel Velazquez

Posted: 10/22/2012
Quote message 

I think the best thing you can do about it is to leave the website in C # but replace or add new web pages in vb.net because Visual Studio. Net can compile both languages ​​simultaneously. I'm about to license Artisteer but this was an issue that concerned me much (I also programmed in vb.net) but with this way of working is enough to give me the functionality I need.

Josman