Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Dumb VB and C++ fact of the Day

Dumb VB and C++ fact of the Day

Scheduled Pinned Locked Moved The Lounge
c++visual-studiotools
61 Posts 30 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O obermd

    When converting stringly typed data from a flat file into strongly typed data for database storage, nothing beats the built in conversion functions found in VB. In addition, VB.net's verboseness means I can look at the header of a function and know exactly what events and what objects those events tie to. In C# this wire-up is frequently hidden in another source file. Having keyword based blocking vs. {} for block controls also helps when working out the logical structure of code. Is that } going to the "if" or the "while" statement 30 lines up? In VB you'll see an End If or Loop so you don't have to guess when looking at the code on paper. Granted, VS's indent lines make this less of an issue now but prior to those indent lines it was an issue. Where C#'s syntax is better is in the implementation of Lambda (anonymous) functions and LINQ syntax. VB.Net's syntax is just awkward here. I also prefer C#'s <> for type declarations for Dictionaries and Lists as it highlights the actual typing without making the New parameters confusing.

    C Offline
    C Offline
    CP777
    wrote on last edited by
    #40

    After using VB.Net for around 8 years, I have been using C#.Net exclusively for the past 5. There are two things I very much still miss about VB.Net - the first of which are those oh-so-hated-by-everyone-else verbose blocking keywords. ESPECIALLY when working at the end of a function or class... [ Next / End If / End Select / End With / End Function ] is instantly easier to understand which blocks you are leaving, than [ }}}}} ] - even when on separate lines. The second is the [ My. ] class - so much exposure to the underlying environment, user profile, settings, and resources... all in one API. At the end of the day, I use C# just to keep fluent in what is arguably the more-widely-used language of the two, but I very much miss the good ol' days.

    1 Reply Last reply
    0
    • S Slow Eddie

      It takes manure to make things grow. Have you ever worked in VB? If not How can you criticize something you don't use? :sigh:

      tired of the VB bashers …..

      R Offline
      R Offline
      realJSOP
      wrote on last edited by
      #41

      In point of fact, I've worked in every evil incarnation of it, but more importantly, I've worked with better languages, so I know from where I speak. Even if I hadn't, I'm old, so I'm entitled to criticize anything I want. Oh, and you can use your cute little disappointment emoji till the cows come home. I don't give two sh|ts about it. (I can say that because I'm old, too.)

      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
      -----
      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
      -----
      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

      S 1 Reply Last reply
      0
      • A atverweij

        Yes, they should always be on. But C# still has the GoTo statement. But that doesn't mean you have to use it :-D

        K Offline
        K Offline
        kalberts
        wrote on last edited by
        #42

        I even make use of it! In switch statements where two or more alternatives have the same (final) handling, it can be really useful, and far safer than the silent fallthrough of classical C (which is not allowed in C#). It lacks a builtin ComeFrom, though; I had to implement that myself. It really is a must when you do more than the elementary exception handling.If you leave the stack dump to the standard library exception handling, you won't be able to pick up the output and process it in a reasonable way. Of course you can't make a ComeFrom without support from the runtime libary. Given the StackTrace / StackFrame classes, it is trivial.

        A 1 Reply Last reply
        0
        • K kalberts

          I even make use of it! In switch statements where two or more alternatives have the same (final) handling, it can be really useful, and far safer than the silent fallthrough of classical C (which is not allowed in C#). It lacks a builtin ComeFrom, though; I had to implement that myself. It really is a must when you do more than the elementary exception handling.If you leave the stack dump to the standard library exception handling, you won't be able to pick up the output and process it in a reasonable way. Of course you can't make a ComeFrom without support from the runtime libary. Given the StackTrace / StackFrame classes, it is trivial.

          A Offline
          A Offline
          atverweij
          wrote on last edited by
          #43

          And so you see - everything has it use :)

          1 Reply Last reply
          0
          • R realJSOP

            Because 13 is an unlucky number. Note, however, that even actively avoiding v13 doesn't rescue VB from being a pile of crap.

            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
            -----
            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
            -----
            When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

            M Offline
            M Offline
            Matt McGuire
            wrote on last edited by
            #44

            why do you think it's crap? is this from personal experience or is from from what others say it is? from my personal experience (and i do have quite a few languages that i use from day to day) it's on par but not equal to C#, VB.net does somethings better than C# and vice versa. and at the end of the day they both compile down to the same IL. i could say javascript is crap because it's an interpenetrated language and other reasons, but it does serve a purpose and does it well, so i wont.

            R 1 Reply Last reply
            0
            • S Stepan Hakobyan

              Please don't be so harsh with VB. I'm working in business automation industry and my day to day languages are C#, TypeScript, VB. Imho VB is the most effective for writing business login.

              D Offline
              D Offline
              Daniel Wilianto
              wrote on last edited by
              #45

              Why shouldn't we? All programming languages have their good and bad. However, there's one thing certain. VB sucks big time. The whole language is way too wordy. It ruins my display with too many characters. "If" must be closed by "End if" "For" must be closed by "End For" "While" must be closed by "End While" How many characters are there in the last one? 9! 9 characters in order to close a code block! I used VB as a beginner. I moved to C# when I got better. Nowadays I use C#, Java, PHP, Javascript (Jquery). I have never thought of going back to VB. It's like an embarrassing past I wan't to bury forever. Using {} is so much much better.

              P 1 Reply Last reply
              0
              • M Matt McGuire

                why do you think it's crap? is this from personal experience or is from from what others say it is? from my personal experience (and i do have quite a few languages that i use from day to day) it's on par but not equal to C#, VB.net does somethings better than C# and vice versa. and at the end of the day they both compile down to the same IL. i could say javascript is crap because it's an interpenetrated language and other reasons, but it does serve a purpose and does it well, so i wont.

                R Offline
                R Offline
                realJSOP
                wrote on last edited by
                #46

                Matt McGuire wrote:

                why do you think it's crap?

                Because of the first two letters in its name. I thought I' made that clear.

                Matt McGuire wrote:

                i could say javascript is crap

                And I don't personally know a single person that would argue with you on that point.

                Matt McGuire wrote:

                but it does serve a purpose

                Only because we let it serve a purpose. Y'all really need to stop arguing the point. It's crap, and I absolutely won't change my mind.

                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                -----
                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                -----
                When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                M 1 Reply Last reply
                0
                • D Daniel Wilianto

                  Why shouldn't we? All programming languages have their good and bad. However, there's one thing certain. VB sucks big time. The whole language is way too wordy. It ruins my display with too many characters. "If" must be closed by "End if" "For" must be closed by "End For" "While" must be closed by "End While" How many characters are there in the last one? 9! 9 characters in order to close a code block! I used VB as a beginner. I moved to C# when I got better. Nowadays I use C#, Java, PHP, Javascript (Jquery). I have never thought of going back to VB. It's like an embarrassing past I wan't to bury forever. Using {} is so much much better.

                  P Offline
                  P Offline
                  Peter Adam
                  wrote on last edited by
                  #47

                  ... except when you accidentally close the wrong block, and spends hours to find out why it is not working.

                  D 1 Reply Last reply
                  0
                  • R realJSOP

                    Because 13 is an unlucky number. Note, however, that even actively avoiding v13 doesn't rescue VB from being a pile of crap.

                    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                    -----
                    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                    -----
                    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                    P Offline
                    P Offline
                    Peter Adam
                    wrote on last edited by
                    #48

                    VB is used in-house, making the software carrying the company forward. C-ish languages used by experts, for boxed software, and for contractor work, carrying their company forward.

                    M 1 Reply Last reply
                    0
                    • R realJSOP

                      Matt McGuire wrote:

                      why do you think it's crap?

                      Because of the first two letters in its name. I thought I' made that clear.

                      Matt McGuire wrote:

                      i could say javascript is crap

                      And I don't personally know a single person that would argue with you on that point.

                      Matt McGuire wrote:

                      but it does serve a purpose

                      Only because we let it serve a purpose. Y'all really need to stop arguing the point. It's crap, and I absolutely won't change my mind.

                      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                      -----
                      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                      -----
                      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                      M Offline
                      M Offline
                      Matt McGuire
                      wrote on last edited by
                      #49

                      I used to be like you years ago, but after a couple decades of coding, i have learned to be more flexible in what i use to get the job done.

                      John Simmons / outlaw programmer wrote:

                      Because of the first two letters in its name. I thought I' made that clear.

                      by the sound of it, you haven't used it, or at least not enough to see some of the benefits that VB.net offers that differentiates it from C#. C# and VB.net are both good languages, and they both have their strengths and weaknesses. I use them both, and ADA, javascript, c, c++, D, Rust,HTML and a few others i dabble in; they all have their own uses. if you want to bash on VB6 go for it, that should have died over 10 years ago. but VB.net is not VB6

                      R 1 Reply Last reply
                      0
                      • M Matt McGuire

                        I used to be like you years ago, but after a couple decades of coding, i have learned to be more flexible in what i use to get the job done.

                        John Simmons / outlaw programmer wrote:

                        Because of the first two letters in its name. I thought I' made that clear.

                        by the sound of it, you haven't used it, or at least not enough to see some of the benefits that VB.net offers that differentiates it from C#. C# and VB.net are both good languages, and they both have their strengths and weaknesses. I use them both, and ADA, javascript, c, c++, D, Rust,HTML and a few others i dabble in; they all have their own uses. if you want to bash on VB6 go for it, that should have died over 10 years ago. but VB.net is not VB6

                        R Offline
                        R Offline
                        realJSOP
                        wrote on last edited by
                        #50

                        Matt McGuire wrote:

                        by the sound of it, you haven't used it, or at least not enough to see some of the benefits that VB.net offers that differentiates it from C#.

                        Once again, and for the last time, I *HAVE* used VB.Net, and it is still crap, just like it's predecessor, VB6.

                        Matt McGuire wrote:

                        if you want to bash on VB6 go for it,

                        I suppose I could equate that with "divine dispensation", but I didn't need it to start with. VB apologists make me laugh out-f*ckin-loud...

                        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                        -----
                        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                        -----
                        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                        M 1 Reply Last reply
                        0
                        • R realJSOP

                          Member 7989122 wrote:

                          As a general rule, people showing the kind of hashness as you do, toward one tool (or standard, or whatever) tend to have a poor understanding of how to use it. Or they consider it out of its intended scope of usage.

                          Or like me, they simply want to trigger the commie hippies that love it.

                          Member 7989122 wrote:

                          A number of years ago ... blah f*ckin blah ... That the end users understand what's going on.

                          (yawn)

                          Member 7989122 wrote:

                          I never used VB,

                          Count your blessings. I've had to use VB, VBscript, VBA, and VB.net. I've been a programmer for almost 40 years, and I think that makes me qualified to identify crap when I see it. It's like the MS Access of computer languages.

                          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                          -----
                          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                          -----
                          When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                          M Offline
                          M Offline
                          Mark Miller
                          wrote on last edited by
                          #51

                          John Simmons / outlaw programmer wrote:

                          It's like the MS Access of computer languages.

                          Or as I like to call it "MS Abscess"... X|

                          Sincerely, -Mark mamiller@rhsnet.org

                          1 Reply Last reply
                          0
                          • R realJSOP

                            In point of fact, I've worked in every evil incarnation of it, but more importantly, I've worked with better languages, so I know from where I speak. Even if I hadn't, I'm old, so I'm entitled to criticize anything I want. Oh, and you can use your cute little disappointment emoji till the cows come home. I don't give two sh|ts about it. (I can say that because I'm old, too.)

                            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                            -----
                            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                            -----
                            When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                            S Offline
                            S Offline
                            Slow Eddie
                            wrote on last edited by
                            #52

                            You are not the only "Old Guy". I am 70 in a few months. I have been working in Basic (GW-Basic) since 1978. I have made a very good living with it, and have happy clients running their businesses all over the Southeast and Central U.S. with my programs. Being "Old" does not entitle you to anything, except the knowledge you will die soon. The emoji was for you, because you sound like a fan-boy millennial in your post. BTW, I am converting my programs to C#, and have found it is more verbose,and does not handle Dates worth a cr@p. I'm doing that so when I finally drop dead at the keyboard, my clients will be able to find one of the younger guys around that know C# to support them. I notice you failed to mention any of the so-called "better" languages you work in. I'd be interested to know what language/framework du-jour you currently like. Get over it, it's all just syntax, in the final analysis. The tool you use is not important, only the product you create

                            Oy! Haters gonna hate.

                            1 Reply Last reply
                            0
                            • R realJSOP

                              Matt McGuire wrote:

                              by the sound of it, you haven't used it, or at least not enough to see some of the benefits that VB.net offers that differentiates it from C#.

                              Once again, and for the last time, I *HAVE* used VB.Net, and it is still crap, just like it's predecessor, VB6.

                              Matt McGuire wrote:

                              if you want to bash on VB6 go for it,

                              I suppose I could equate that with "divine dispensation", but I didn't need it to start with. VB apologists make me laugh out-f*ckin-loud...

                              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                              -----
                              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                              -----
                              When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                              M Offline
                              M Offline
                              Matt McGuire
                              wrote on last edited by
                              #53

                              Look I'm not here to convince you otherwise, you have your standpoint and i will respect that, even if i don't agree with it. My only request is to not bash on others for their personal preferences. if there was constructive criticism over a language feature, I have no issue with, but to say something is just "crap" is not helpful and will lead to angering others for no purpose what so ever.

                              1 Reply Last reply
                              0
                              • P Peter Adam

                                VB is used in-house, making the software carrying the company forward. C-ish languages used by experts, for boxed software, and for contractor work, carrying their company forward.

                                M Offline
                                M Offline
                                Matt McGuire
                                wrote on last edited by
                                #54

                                I would debate that, this stems from the old long debate of VB6 vs. C++. I use to develop industrial control systems that controlled directly to the IO with VB.Net and had several hundred installations. the difference between c# and vb.net is not a lot. both are good languages, and both had good features, both have their own benefits, what it actually comes down to is do you prefer "{}" or "if, end if"; it still compiles down to the same IL.

                                1 Reply Last reply
                                0
                                • C Chris Maunder

                                  There's no Visual Basic 13.0 nor C++ 13.0. They went from VB 12.0 in VS 2013 to VB 14.0 in VS 2015, and Visual C++ 12.0 in VS 2013 to Visual C++ 14.0 in VS 2015. [Edited to add the C++ factoid. Yeah, this is my afternoon of productivity]

                                  cheers Chris Maunder

                                  J Offline
                                  J Offline
                                  Jim Meadors
                                  wrote on last edited by
                                  #55

                                  Wow! Looking at this thread suggests that any VB facts should be posted in Soapbox :laugh:

                                  <sig notetoself="think of a better signature"> <first>Jim</first> <last>Meadors</last> </sig>

                                  1 Reply Last reply
                                  0
                                  • P Peter Adam

                                    ... except when you accidentally close the wrong block, and spends hours to find out why it is not working.

                                    D Offline
                                    D Offline
                                    Daniel Wilianto
                                    wrote on last edited by
                                    #56

                                    I have never experienced that. You should never too. If you indent parent block and children block properly.

                                    1 Reply Last reply
                                    0
                                    • C Chris Maunder

                                      There's no Visual Basic 13.0 nor C++ 13.0. They went from VB 12.0 in VS 2013 to VB 14.0 in VS 2015, and Visual C++ 12.0 in VS 2013 to Visual C++ 14.0 in VS 2015. [Edited to add the C++ factoid. Yeah, this is my afternoon of productivity]

                                      cheers Chris Maunder

                                      M Offline
                                      M Offline
                                      Member 9167057
                                      wrote on last edited by
                                      #57

                                      I remember a company needing to change a product name in China as the original name contained 250 which reads as "bad luck" or "death" (one of those) in Chinese. My favorite is still the MR2 car which sold rather poorly in France.

                                      1 Reply Last reply
                                      0
                                      • O obermd

                                        I'd have to argue that VBA is a real programming language, but that it's limited by the host application. VBA in Excel is extremely powerful. VBA in Word has been lobotomized. VB6 was good for what it was intended to do and represents a completely different era of Windows programming.

                                        Z Offline
                                        Z Offline
                                        ZevSpitz
                                        wrote on last edited by
                                        #58

                                        You mean the Excel and Word object models, respectively. You can easily access the Word object model from Excel, and the Excel object model from Word. You can also access both object models from an external program/script -- .NET languages, Python, VBScript, JScript and others. I think the limitations of these object models are independent of the language. VBA (and VB6) is limited in that it doesn't have a first-class-function mechanism (AddressOf doesn't count, as AFAICT there is no way to call such a function pointer from VBA), nor does it have a lambda function syntax. This means that LINQ/FP-style data processing is impossible in VBA/VB6, and filtering / sorting / projecting any collection of data involves nested For Each and conditional blocks.

                                        1 Reply Last reply
                                        0
                                        • R realJSOP

                                          ZevSpitz wrote:

                                          I'm curious to know why you feel that way about VB.NET

                                          Because the name starts with "VB".

                                          ZevSpitz wrote:

                                          which can express virtually everything that C# can; and like other .NET languages can make use of (almost all of) the types in the .NET Framework.

                                          The words "virtually" and "almost" should be indicators for you...

                                          ZevSpitz wrote:

                                          There are obviously various small differences (VB.NET allows inferring the delegate type, allows assigning a numeric string to a number, etc.)

                                          "Inferring" and being typeless do not make VB a better idea. Unless you're a commie... or liberal...

                                          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                                          -----
                                          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                                          -----
                                          When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                                          Z Offline
                                          Z Offline
                                          ZevSpitz
                                          wrote on last edited by
                                          #59

                                          John Simmons / outlaw programmer wrote:

                                          Because the name starts with "VB".

                                          Because you don't like the name? It seems to me your dislike is far to strong to be justified by this.

                                          John Simmons / outlaw programmer wrote:

                                          The words "virtually" and "almost" should be indicators for you...

                                          I was referring specifically to pattern matching and types that make use of Span, which are both relatively new features in C# and .NET in general. Unsafe code is also something that C# has which VB.NET doesn't. IMO, pattern matching is as much a game-changer as LINQ, in writing expressive code, and it is quite unfortunate that it is not yet in VB.NET. But I think the others are relatively edge cases. Your average business developer, targeting a Web stack or desktop application, doesn't need the higher performance of Span, or unsafe programming -- not in C# and not in VB.NET. Are you aware of other differences in day-to-day usage? Please feel free to correct me.

                                          John Simmons / outlaw programmer wrote:

                                          "Inferring" and being typeless do not make VB a better idea.

                                          I think that inferring the type in general is a good idea (using `var` in C# or `auto` in C++), because the code becomes more declarative -- focused on the intent of the code, and less focused on the mechanism the code will use. It's true that when every byte matters, it may be important to specify the type as byte, but again, I think these are relatively edge cases. But I didn't say I think these are good things; only that these are things that work in VB.NET and will not work when transferring this knowledge over to C#. (In fact, inferring delegate types from lambda expressions might involve a serious performance hit. If I have a database with a million records, and I use an ORM to extract the records which match a certain condition:

                                          Dim qry As IQueryable(Of Person)

                                          'fill qry

                                          Dim filter = Function(x As Person) x.LastName.StartsWith("A")
                                          Dim results = qry.Where(filter)

                                          this code will use the Enumerable.Where extension method (which takes a delegate instance and not an expression), retrieve all the records in the database, and filter them in memory in the application code, all without any error. C# will not allow this, and force you to explicitly type filter as

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups