Results 1 to 19 of 19

Thread: [RESOLVED] VB.NET or C++ ?

  1. #1

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Resolved [RESOLVED] VB.NET or C++ ?

    Hi Guys,

    Basically, I am getting a bit sick of people complaining about having to install the .NET framework to run any of my apps and various other limitations of VB.NET are also getting annoying. Dont ask me to give a list but I just remember coming accross several things recently that could not be done very easily in VB and people recommended using C++ instead...
    So what im asking is - would it be worth switching to C++ and are there REALLY many benefits? Im certainly no expert at VB.NET and have only written a small handful of programs (ive been learning it on and off for a few months) but it does seem a shame to scrap all that and start a fresh on a new language...
    Is C++ a lot harder to learn? Especially bearing in mind that I wont be devoting loads of my time to it, programming is more just a hobby than anything for me but does occasionally come in handy at work (im a network and server admin).

    Any opinions on this subject? Any advice?

    Cheers
    Chris
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: VB.NET or C++ ?

    C++ is harder to learn, in my opinion. And its not really fair to compare the two languages.
    VB .Net is a rapid development language, its designed so that you can create applications fast. C++ is not, however C++ provides more horse power and cross-platform development. Choose language depending on your needs.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: VB.NET or C++ ?

    Yeah I guess I understand that, but when you say more horsepower what exactly do you mean? This is what im trying to establish, what exactly is it that C++ does better than VB.NET? All I ever hear is "its more powerful" but without a proper explanation its very hard to know exactly what that means...
    So is it not possible to just create a "quick" small application in C++? What is it that makes it slow, do you have to write a lot more code to accomplish the same thing?
    Thanks again
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  4. #4
    Frenzied Member
    Join Date
    May 2006
    Location
    Toronto, ON
    Posts
    1,093

    Re: VB.NET or C++ ?

    C++ is designed to access things at a really base level. VB.NET is a bunch of code where all that base level accessing is already bundled into things for you to use. That makes it easier to use, but because it's all bundled together, it's a bit generic, so writing low-level code that's tailored specifically to what your application is doing, rather than having to account for what thousands of applications might do is always going to result in the C++ code running faster.

    It depends what you're building as to which is the better choice. If you're building an application with a user interface where getting the user to perform some task is more important than making sure that a result is given 0.9 seconds after they press a button rather than it taking 1.2 seconds, then VB.NET is likely your choice. If you're building a program that runs in the background and uses a lot of system resources and complex object management, then C++ would be a better choice.

  5. #5

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: VB.NET or C++ ?

    Hmm well to be honest about 75% of my applications are more user interface orientated so I suppose it sounds like I would be better suited to using VB.NET still..
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  6. #6
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: VB.NET or C++ ?

    The harder part, I would say, would be because of all the pointer hell. It's insane. Sometimes you have a pointer to a pointer to a pointer of a reference to a pointer of an int.. lol ok maybe I went a little overboard there, but it can be really hard to understand.

    There's no garbage collection so you have to actually keep track of your objects *GASP* and dispose of them properly.

    The .NET Framework also has a lot of member functions to automatically do what you may need to write your own classes, structures, and functions for in C++. In that way, designing programs can be quicker using .NET.

    Also, with C++, if you don't have a good resource creator tool (I suggest ResEd), then creating buttons, textboxes, and other controls can be a real pain! It can take hours to design a dialog in C++ where it would take minutes in VB .NET.

    Personally, I don't like all of the include statements in C++. If you include a header file, then you get all of the header files that that header file includes and all of the header files that that header file includes and so on and so on. You can end up importing something more than once and can accidentally import something you don't want to and you may end up having class name, functions, etc. name conflicts.

    As for the power difference people are talking about, it's not as much as people think it is. A while ago, people said that there was no way you could design a game in something like C# or VB .NET, but commercial games are still being made using C# or VB .NET and running fine. Of course there is a speed difference, though. C++ is a lower level language. It was direct access to API calls whereas in the .NET Framework, you'd have to import these API calls and whatnot. If you see what I mean, you can see why there is a speed difference. C++ is closer, so to say, to the operating system's set of APIs. They have direct access to them, where the .NET Framework abstracts the layer, making an extra layer to have to go through for manipulating the OS using APIs.

    Personally, I don't think it would be really necessary to use C++ instead of VB .NET for speed differences, unless you are using some intense CPU usage. For example, if you are writing a Macro program, it may be better to use C++ instead of VB .NET because you have direct access to APIs such as keybd_event and mouse_event, whereas in VB .NET you would have to first import these DLLs and then go through a layer of abstraction for each call. It may end up costing you some speed, or might not.

    I have found speed differences between languages to be nominal. In my book, it's not the speed of the language that matters, but how you implement your code and algorithms. C++'s raw power with a crappy algorithm is no match for VB .NET's with a well written application.

    My advice to you is this. Just use whichever suits you. Use which one you are better with. If you're writing memory leaks in C++ by mistake, it's going to be a lot slower than an application written in VB .NET.

    You do know, though, that you can import API's, right? When people are telling you to use C++ instead, is it just because you need to use some specific APIs like SendMessage? You can easily import these into your application. Try using this website: http://www.pinvoke.net/

    There you can find specific API import declarations for both VB .NET and C#. You can easily put these into your program and then use the APIs just as if you were using them in C++, with the exception of possible using some different types like IntPtr. However, be sure to include the System.Runtime.InteropServices. You need that one for the DllImport attribute.

    Hopefully this helped. Oww, my hands hurt

  7. #7
    Frenzied Member
    Join Date
    May 2006
    Location
    Toronto, ON
    Posts
    1,093

    Re: VB.NET or C++ ?

    Quote Originally Posted by chris128
    Hmm well to be honest about 75% of my applications are more user interface orientated so I suppose it sounds like I would be better suited to using VB.NET still..
    Ya, if you've got anything with a user interface, then C++ tends to be more trouble than it's worth and any speed increases would be nominal at best.

    You may want to create some dlls with them if you have some intensive processing that could be sped up by managing your own pointers, but unless you really know what you're doing, you could cause more troubles than you solve and having applications with different parts written in different languages is bad programming practice and makes for a maintenance nightmare.

    If users are complaining about having to download the latest framework, take away their computer and replace it with a TRS-80 and some floppy disks. It's 2008 and if they don't want to use the latest tools then they can live with obsolete stuff.

  8. #8

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: VB.NET or C++ ?

    Thanks to Fromethius for the detailed answer and thanks to everyone else, I think its quite clear to me now that I should stick with VB.NET as like a lot of you have said, its going to be more trouble than its worth trying to use C++.

    Cheers
    Chris
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  9. #9
    Addicted Member
    Join Date
    Dec 2007
    Posts
    167

    Re: [RESOLVED] VB.NET or C++ ?

    I have a question, I always wondering why dont Microsoft include the VB6 runtimes files(winsock,intel...) in WinXP and .Net Framework 3.5 and runtimes files in Windows Vista? I mean all the files together are less than 10 MB and if they do so our VB programs will be smaller in size...
    why dont they?

  10. #10
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [RESOLVED] VB.NET or C++ ?

    Microsoft has dropped support for VB6.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  11. #11

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [RESOLVED] VB.NET or C++ ?

    I thought Vista did have .NET 3 installed by default?
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  12. #12
    Addicted Member
    Join Date
    Dec 2007
    Posts
    167

    Re: [RESOLVED] VB.NET or C++ ?

    2008 uses .NET 3.5 ....

  13. #13
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [RESOLVED] VB.NET or C++ ?

    VS 2008 is just an IDE. You can change the target framework in the project settings. But yes, but default, it is the .NET Framework 3.5 for the sake of new development.

  14. #14

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [RESOLVED] VB.NET or C++ ?

    Quote Originally Posted by Fromethius
    VS 2008 is just an IDE. You can change the target framework in the project settings. But yes, but default, it is the .NET Framework 3.5 for the sake of new development.
    ohhhh yeah, i always forget that and think "aw **** I cant use VB 2008 cos Im making something that needs to use .Net 2.0"
    Thanks for reminding me
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  15. #15
    Addicted Member
    Join Date
    Dec 2007
    Posts
    167

    Re: [RESOLVED] VB.NET or C++ ?

    how can sometihing need .Net 2.0? isnt everything in .Net 2 found in .Net 3.5?

  16. #16
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [RESOLVED] VB.NET or C++ ?

    Quote Originally Posted by perito
    how can sometihing need .Net 2.0? isnt everything in .Net 2 found in .Net 3.5?
    Yes but if a large company uses .Net 2.0 on all their computers, its easier to target the .Net 2.0 frameework when developing applications for that company instead of having them update all computers to .Net 3.5.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  17. #17

    Thread Starter
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: [RESOLVED] VB.NET or C++ ?

    Quote Originally Posted by Atheist
    Yes but if a large company uses .Net 2.0 on all their computers, its easier to target the .Net 2.0 frameework when developing applications for that company instead of having them update all computers to .Net 3.5.
    exactly my situation
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  18. #18
    Frenzied Member
    Join Date
    May 2006
    Location
    Toronto, ON
    Posts
    1,093

    Re: [RESOLVED] VB.NET or C++ ?

    Quote Originally Posted by chris128
    exactly my situation
    If you create a setup package for your app, it should install the 3.5 framework during the setup, so there won't be any additional maintenance needed as the only people getting the framework updated are the ones installing the application anyways.

  19. #19
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: [RESOLVED] VB.NET or C++ ?

    Quote Originally Posted by Atheist
    Yes but if a large company uses .Net 2.0 on all their computers, its easier to target the .Net 2.0 frameework when developing applications for that company instead of having them update all computers to .Net 3.5.
    The last I heard from Microsoft (Slow chat) was the 3.0 framework builds directly on top of the 2.0 framework and the 3.5 framework builds directly on top of the 3.0 framework.


    Quote Originally Posted by Tom Sawyer
    If you create a setup package for your app, it should install the 3.5 framework during the setup, so there won't be any additional maintenance needed as the only people getting the framework updated are the ones installing the application anyways.
    Only if you "target" the 3.5 framework, if your application only uses the 2.0 framework then you actually don't require the 3.5 framework, same goes for the 3.0 framework. You should only target the highest level framework that you actually need, this saves you and the "customer"/"user" time.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width