1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

C# and VB can be used in same project in ASP.Net

Discussion in 'C#' started by alamlinks, Dec 11, 2012.

  1. #1
    Hello Friends,
    SEMrush
    I and one of friend are working in a same project in ASP.Net, But the problem is he is expert in VB and I am fluent in C#.

    Now the question is can we both work together using both the language C# and VB OR both have work in same language. I mean code of C# can be converted in VB or code of VB can be converted in C#? If it is possible then please tell me how can we do this?

    Please PM me

    Thanks in advance
     
    alamlinks, Dec 11, 2012 IP
    SEMrush
  2. agitetech

    agitetech Peon

    Messages:
    122
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Nope you can not use both the languages in the same project...because at the starting of the project you have to choose any 1 language from this 2 languages...
     
    agitetech, Dec 14, 2012 IP
  3. alamlinks

    alamlinks Active Member

    Messages:
    978
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    90
    #3
    I am sure you are new than me in ASP.Net, any way I got my answer. download conversion tool and install it in your PC with the Dot.Net


     
    alamlinks, Dec 18, 2012 IP
  4. miguelf

    miguelf Member

    Messages:
    98
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    48
    #4
    You will have to use different assemblies. Create a class library with VB and the program code in C#. The C# code can load and use library written in VB.
     
    miguelf, Jan 15, 2013 IP
  5. DrShirts

    DrShirts Peon

    Messages:
    28
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    1
    #5
    Yes it can!!!!!... Kinda...
    But one has to be compiled!

    I sometimes use C# code in my VB app by adding it as a dll library
    another time I was modifying an existing app compiled with c# by adding CODE INLINE using vb.net

    also there are converters C#->VB and Vice Versa you can use to just use one language.


    ----
    Like my answer? Like my post! Thanks
     
    DrShirts, Jan 20, 2013 IP
  6. brandon813

    brandon813 Member

    Messages:
    77
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #6
    Yes, of course you can do this. You can either create separate class libraries as explained above OR you can make separate C# and VB.Net App_Code folders;

    <compilation debug="true" strict="true" explicit="true">
          <codeSubDirectories>
            <add directoryName="VBCode" />
            <add directoryName="CSCode" />
          </codeSubDirectories>
    Code (markup):
    Lastly, there is no reason you cannot create code-behind pages with C# or VB .net
     
    brandon813, Feb 12, 2013 IP
  7. sigmainfo

    sigmainfo Active Member

    Messages:
    495
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    55
    #7
    Yes, in Asp.Net i.e. Microsoft Technologies Development Services, includes Legacy application development using ACCESS and VBA
     
    sigmainfo, Feb 14, 2013 IP
  8. annaharris

    annaharris Active Member

    Messages:
    119
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    51
    #8
    You can't use VB and C# in the same project. In visual studio The project file is either .vbproj or .csproj. you can choose any one from both.
     
    annaharris, Mar 29, 2013 IP
  9. Egor V. Sorokin

    Egor V. Sorokin Member

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    46
    #9
    You can use references in Visual Studio (right-click to Solution Explorer, Add Reference) for adding reference to another build (no difference, C# or VB written). Theoretically, you can create Form1 at C# and Form2 at VB. But i think, this way is not optimized, so i want recommend you use Enterprise Templates Project (u can find it in MSDN web library.
    You can create different blocks both in VB and C#.
     
    Egor V. Sorokin, Apr 3, 2013 IP
  10. annaharris

    annaharris Active Member

    Messages:
    119
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    51
    #10
    I don't think that you can use both languages C# and VB togetherly in the same project as before starting the project it asks to choose any one language.
     
    annaharris, Apr 4, 2013 IP
  11. topcoder

    topcoder Active Member

    Messages:
    122
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    88
    #11
    You can have 1 solution files that contains many projects and each of the individual projects can be in either VB or C#, then you can reference the each others projects (which can be classes) from a different project. So you can effectively work on different modules (Projects) under the same solution.

    Or you can just use a code converter to convert everything, I recommend converting the VB to C#, sometimes the conversion for C# to VB doesn't work properly.
     
    topcoder, May 9, 2013 IP
  12. E_books

    E_books Banned

    Messages:
    39
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    23
    #12
    I dont think you will be able to use c# and vb in same project in asp.net but i dont think its too difficult to code if you know any of the languages. because classes are common just little syntax difference in both the languages
     
    E_books, May 10, 2013 IP
    technoguy likes this.
  13. annaharris

    annaharris Active Member

    Messages:
    119
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    51
    #13
    At the beginning of the project you have to choose one language, either it can be VB.Net or C#. Thus, you don't need both languages simultaneously.
     
    annaharris, May 15, 2013 IP
  14. sagaradsennse

    sagaradsennse Member

    Messages:
    159
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #14
    @noorlinks yes you may use both language in same application. Just create different folder like vb and csharp inside app_code then made changes inside .cofing you may use. I already used that one.
     
    sagaradsennse, Sep 23, 2013 IP
  15. Dot_Net

    Dot_Net Greenhorn

    Messages:
    30
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    23
    #15
    According to me its not possible to use both in one project you should select either c# or vb as programming language and you can use it for entire project
     
    Dot_Net, Nov 13, 2013 IP
    mymindrules likes this.
  16. MakZF

    MakZF Well-Known Member

    Messages:
    390
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    140
    #16
    Just do it all in C#. Mixing different languages could get confusing and restrictive, and VB is a rather niche language anyway.
     
    MakZF, Nov 25, 2013 IP
  17. born_star16

    born_star16 Member

    Messages:
    297
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    36
    #17
    We may not use both programming languages C# and VB in same Asp.net project. The extension name of C# project file is .csproj and VB is .vbproj. I would like to suggest that choose any one programming language either C# or VB.
     
    born_star16, Mar 24, 2014 IP
  18. jagathdesigner

    jagathdesigner Active Member

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    78
    #18
    Yes it possible to have c# and vb.net Website project. Libraries to be shared by both languages should be placed in Appcode. There is an <Codesubcategories> setting in web config . it tells which language should be complied first.
     
    jagathdesigner, Sep 3, 2014 IP
  19. pho3nix_

    pho3nix_ Active Member

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    66
    Digital Goods:
    1
    #19
    Yes you can in website project only Inside App_code and need change web.config.
     
    pho3nix_, Oct 24, 2014 IP
  20. anushka123

    anushka123 Greenhorn

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #20
    You can not use both vb and c# within the same project - if you notice in visual studio the project files are either .vbproj or .csproj. You can within a solution - have 1 proj in vb and 1 in c#.
     
    anushka123, Oct 26, 2014 IP