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. Visual Basic needs more credit

Visual Basic needs more credit

Scheduled Pinned Locked Moved The Lounge
206 Posts 32 Posters 87 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.
  • J JMK NI

    You can write code that fails completely silently in other languages too :doh:

    C Offline
    C Offline
    Colborne_Greg
    wrote on last edited by
    #19

    That code doesn't fail

    P 1 Reply Last reply
    0
    • C Colborne_Greg

      I think that Visual Basic should be shown off for its beauty and elegance. Here is a sample of what it can do - that no other language can do:

      Private Sub AlbumListPopulate()
      Try
      AlbumsList.ItemsSource = New List(Of Image)

          For Each AlbumName In Pictures.Albums
              Try
                  AlbumsList.ItemsSource.Add \_
                      (
                          New Image With
                          {
                              .Height = 150,
                              .Width = 150,
                              .Source = RotateStream \_
                              (
                                  Pictures.Album(AlbumName).Picture,
                                  Pictures.Album(AlbumName).Angle
                              )
                          }
                      )
              Catch
              End Try
          Next
      Catch
      End Try
      

      End Sub

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #20

      Colborne_Greg wrote:

      Catch End Try

      No, it doesn't need more credit; and your example sums up nicely why VB got that reputation :) Yes, you can swallow exceptions in other languages too, but it doesn't happen as often there as it does in VB.

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      C 1 Reply Last reply
      0
      • C Colborne_Greg

        I think that Visual Basic should be shown off for its beauty and elegance. Here is a sample of what it can do - that no other language can do:

        Private Sub AlbumListPopulate()
        Try
        AlbumsList.ItemsSource = New List(Of Image)

            For Each AlbumName In Pictures.Albums
                Try
                    AlbumsList.ItemsSource.Add \_
                        (
                            New Image With
                            {
                                .Height = 150,
                                .Width = 150,
                                .Source = RotateStream \_
                                (
                                    Pictures.Album(AlbumName).Picture,
                                    Pictures.Album(AlbumName).Angle
                                )
                            }
                        )
                Catch
                End Try
            Next
        Catch
        End Try
        

        End Sub

        J Offline
        J Offline
        Jorgen Andersson
        wrote on last edited by
        #21

        I totally agree on that most of the complaints about VB is of the immature kind. But one thing I need to give them is the On Error Resume abomination. Which you sadly have emulated with your empty Catch. :sigh: My personal opinion is that since C# and VB.Net is based on the same CLR and the same Framework, most quarrels are just silly. Use what you feel most at home with, but stop being ridiculous about it!

        Wrong is evil and must be defeated. - Jeff Ello[^]

        P C 3 Replies Last reply
        0
        • P Pete OHanlon

          I have to say, you walked right into that one.

          C Offline
          C Offline
          Colborne_Greg
          wrote on last edited by
          #22

          No better way to learn. I was told that C# and visual basic are the same language but I can find things in Visual Basic that are not in C# and things in C# that are not in Visual Basic

          P R 2 Replies Last reply
          0
          • L Lost User

            Colborne_Greg wrote:

            Catch End Try

            No, it doesn't need more credit; and your example sums up nicely why VB got that reputation :) Yes, you can swallow exceptions in other languages too, but it doesn't happen as often there as it does in VB.

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

            C Offline
            C Offline
            Colborne_Greg
            wrote on last edited by
            #23

            That's just laziness and the expectation that it works 100% of the time

            L 1 Reply Last reply
            0
            • C Colborne_Greg

              I think that Visual Basic should be shown off for its beauty and elegance. Here is a sample of what it can do - that no other language can do:

              Private Sub AlbumListPopulate()
              Try
              AlbumsList.ItemsSource = New List(Of Image)

                  For Each AlbumName In Pictures.Albums
                      Try
                          AlbumsList.ItemsSource.Add \_
                              (
                                  New Image With
                                  {
                                      .Height = 150,
                                      .Width = 150,
                                      .Source = RotateStream \_
                                      (
                                          Pictures.Album(AlbumName).Picture,
                                          Pictures.Album(AlbumName).Angle
                                      )
                                  }
                              )
                      Catch
                      End Try
                  Next
              Catch
              End Try
              

              End Sub

              Z Offline
              Z Offline
              ZurdoDev
              wrote on last edited by
              #24

              I do miss the with operator. I have cases where it could save hundreds of characters and make it way easier to read. Don't listen to the C# purists. :zzz:

              There are only 10 types of people in the world, those who understand binary and those who don't.

              P S 2 Replies Last reply
              0
              • P Pete OHanlon

                I have to say, you walked right into that one.

                K Offline
                K Offline
                Kenneth Haugland
                wrote on last edited by
                #25

                With his pants on fire :laugh: I read somewhere that there are things that VB can do and C# can't an vice versa though... Think it had something to do with Errorhandling ?

                C D R 3 Replies Last reply
                0
                • P Pete OHanlon

                  So, the same as Auto-initialisation in C# then.

                  new Image{ Height = 150, Width= 150 }

                  C Offline
                  C Offline
                  Colborne_Greg
                  wrote on last edited by
                  #26

                  I never knew

                  1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    That's what makes C# better than VB. :-D Try writing an event that returns a value in VB. :cool:

                    You'll never get very far if all you do is follow instructions.

                    C Offline
                    C Offline
                    Colborne_Greg
                    wrote on last edited by
                    #27

                    I would say the opposite

                    1 Reply Last reply
                    0
                    • C Colborne_Greg

                      That code doesn't fail

                      P Offline
                      P Offline
                      Pualee
                      wrote on last edited by
                      #28

                      What if Pictures is null?

                      C 1 Reply Last reply
                      0
                      • C Colborne_Greg

                        No better way to learn. I was told that C# and visual basic are the same language but I can find things in Visual Basic that are not in C# and things in C# that are not in Visual Basic

                        P Offline
                        P Offline
                        PIEBALDconsult
                        wrote on last edited by
                        #29

                        That's what makes C# better than VB. :-D Try writing an event that returns a value in VB. :cool:

                        You'll never get very far if all you do is follow instructions.

                        C J 3 Replies Last reply
                        0
                        • P PIEBALDconsult

                          As well there shouldn't be. C# doesn't need it.

                          You'll never get very far if all you do is follow instructions.

                          C Offline
                          C Offline
                          Colborne_Greg
                          wrote on last edited by
                          #30

                          Considering the missing connection between me knowing C# can get away without using the with word, proves its problems. The with keyword gets the coder in a mindset.

                          OriginalGriffO P R 3 Replies Last reply
                          0
                          • Z ZurdoDev

                            I do miss the with operator. I have cases where it could save hundreds of characters and make it way easier to read. Don't listen to the C# purists. :zzz:

                            There are only 10 types of people in the world, those who understand binary and those who don't.

                            P Offline
                            P Offline
                            PIEBALDconsult
                            wrote on last edited by
                            #31

                            RyanDev wrote:

                            and make it way easier to read

                            I would argue the opposite.

                            You'll never get very far if all you do is follow instructions.

                            Z B L C 4 Replies Last reply
                            0
                            • P Pualee

                              What if Pictures is null?

                              C Offline
                              C Offline
                              Colborne_Greg
                              wrote on last edited by
                              #32

                              If pictures is null the memory space creates itself and returns a empty album list

                              M 1 Reply Last reply
                              0
                              • Richard DeemingR Richard Deeming

                                See my answer to your other post - you don't need the With operator in C# for object or collection initializers.


                                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                                C Offline
                                C Offline
                                Colborne_Greg
                                wrote on last edited by
                                #33

                                this message is spam

                                Richard DeemingR 1 Reply Last reply
                                0
                                • P PIEBALDconsult

                                  RyanDev wrote:

                                  and make it way easier to read

                                  I would argue the opposite.

                                  You'll never get very far if all you do is follow instructions.

                                  Z Offline
                                  Z Offline
                                  ZurdoDev
                                  wrote on last edited by
                                  #34

                                  A lot of people do. I can't understand why, but yes, a lot of people do.

                                  There are only 10 types of people in the world, those who understand binary and those who don't.

                                  C 1 Reply Last reply
                                  0
                                  • C Colborne_Greg

                                    I think that Visual Basic should be shown off for its beauty and elegance. Here is a sample of what it can do - that no other language can do:

                                    Private Sub AlbumListPopulate()
                                    Try
                                    AlbumsList.ItemsSource = New List(Of Image)

                                        For Each AlbumName In Pictures.Albums
                                            Try
                                                AlbumsList.ItemsSource.Add \_
                                                    (
                                                        New Image With
                                                        {
                                                            .Height = 150,
                                                            .Width = 150,
                                                            .Source = RotateStream \_
                                                            (
                                                                Pictures.Album(AlbumName).Picture,
                                                                Pictures.Album(AlbumName).Angle
                                                            )
                                                        }
                                                    )
                                            Catch
                                            End Try
                                        Next
                                    Catch
                                    End Try
                                    

                                    End Sub

                                    B Offline
                                    B Offline
                                    BobJanova
                                    wrote on last edited by
                                    #35

                                    If you'd picked a case of With doing namespace/object elision, you might have a point. But as several people have pointed out, this is an object initialiser which is included in C# and (I think) has been since the same .Net compiler version as the VB.Net syntax you're demonstrating. Other languages like JavaScript, Ruby, Perl etc can create objects with data in a single statement like this, too, and have been able to for years. If you're going to make a claim like "no other language can do [something your fave can]" then at least a tiny bit of research would be a good idea.

                                    C 1 Reply Last reply
                                    0
                                    • Richard DeemingR Richard Deeming

                                      Just because you don't need the extra keyword doesn't mean that C# can't do it:

                                      new Image
                                      {
                                      Height = 150,
                                      Width = 150,
                                      Source = RotateStream
                                      (
                                      Pictures.Album[AlbumName].Picture,
                                      Pictures.Album[AlbumName].Angle
                                      )
                                      }


                                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                                      C Offline
                                      C Offline
                                      Colborne_Greg
                                      wrote on last edited by
                                      #36

                                      That code would fail as the scopes would be confused

                                      Richard DeemingR 1 Reply Last reply
                                      0
                                      • B BobJanova

                                        If you'd picked a case of With doing namespace/object elision, you might have a point. But as several people have pointed out, this is an object initialiser which is included in C# and (I think) has been since the same .Net compiler version as the VB.Net syntax you're demonstrating. Other languages like JavaScript, Ruby, Perl etc can create objects with data in a single statement like this, too, and have been able to for years. If you're going to make a claim like "no other language can do [something your fave can]" then at least a tiny bit of research would be a good idea.

                                        C Offline
                                        C Offline
                                        Colborne_Greg
                                        wrote on last edited by
                                        #37

                                        Without the with operator C# has a smaller scope

                                        S 1 Reply Last reply
                                        0
                                        • J Jorgen Andersson

                                          I totally agree on that most of the complaints about VB is of the immature kind. But one thing I need to give them is the On Error Resume abomination. Which you sadly have emulated with your empty Catch. :sigh: My personal opinion is that since C# and VB.Net is based on the same CLR and the same Framework, most quarrels are just silly. Use what you feel most at home with, but stop being ridiculous about it!

                                          Wrong is evil and must be defeated. - Jeff Ello[^]

                                          P Offline
                                          P Offline
                                          Pualee
                                          wrote on last edited by
                                          #38

                                          I took a job once, with no knowledge of VB (Visual Studio 6). Hey, I just wanted a well paying part time job to finish my master's degree. One of the 'best practices' of the company was to always add "On Error Resume Next" at the beginning of each and every function. I asked why, and the reply was that it just works better that way. The job paid the bills, I graduated, I got a new job, the company went under (not because I left, but I saw the writing on the wall ahead of time - they had too many people and no contracts lined up).

                                          C 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