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 300 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.
  • 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
    #2

    Wrong forum, try http://www.codeproject.com/Feature/WeirdAndWonderful.aspx[^].

    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

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

      What about that can't be done in C#? :confused:

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

      C P L 3 Replies Last reply
      0
      • P PIEBALDconsult

        What about that can't be done in C#? :confused:

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

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

        With operator

        Richard DeemingR S 2 Replies 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

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #5

          Colborne_Greg wrote:

          that no other language can do

          Pretty bold statement, given it's followed by a code block that could easily be converted to C#. ;P


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

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

          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

            S Offline
            S Offline
            Simon_Whale
            wrote on last edited by
            #6

            I would make sure you have your flame proof pants on..

            Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

            1 Reply Last reply
            0
            • P PIEBALDconsult

              What about that can't be done in C#? :confused:

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

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #7

              I suspect he's talking about the With block. Of course, as the With statement was introduced to fix a defect in VB in the first place...

              C 1 Reply Last reply
              0
              • Richard DeemingR Richard Deeming

                Colborne_Greg wrote:

                that no other language can do

                Pretty bold statement, given it's followed by a code block that could easily be converted to C#. ;P


                "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
                #8

                no with operator in C#

                Richard DeemingR P D P 4 Replies Last reply
                0
                • C Colborne_Greg

                  With operator

                  Richard DeemingR Offline
                  Richard DeemingR Offline
                  Richard Deeming
                  wrote on last edited by
                  #9

                  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

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

                  C 1 Reply Last reply
                  0
                  • C Colborne_Greg

                    no with operator in C#

                    Richard DeemingR Offline
                    Richard DeemingR Offline
                    Richard Deeming
                    wrote on last edited by
                    #10

                    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

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

                    C 1 Reply Last reply
                    0
                    • P Pete OHanlon

                      I suspect he's talking about the With block. Of course, as the With statement was introduced to fix a defect in VB in the first place...

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

                      its not a with block, "new image with"

                      S Richard DeemingR P 3 Replies Last reply
                      0
                      • C Colborne_Greg

                        no with operator in C#

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

                        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 1 Reply Last reply
                        0
                        • C Colborne_Greg

                          its not a with block, "new image with"

                          S Offline
                          S Offline
                          Simon_Whale
                          wrote on last edited by
                          #13

                          and you can do the same in C# without the need for "with" keyword

                          Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

                          C 1 Reply Last reply
                          0
                          • C Colborne_Greg

                            no with operator in C#

                            D Offline
                            D Offline
                            Dr Walt Fair PE
                            wrote on last edited by
                            #14

                            Colborne_Greg wrote:

                            fortunately, no with operator in C#

                            FTFY

                            CQ de W5ALT

                            Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

                            1 Reply Last reply
                            0
                            • C Colborne_Greg

                              its not a with block, "new image with"

                              Richard DeemingR Offline
                              Richard DeemingR Offline
                              Richard Deeming
                              wrote on last edited by
                              #15

                              Colborne_Greg wrote:

                              its not a with block

                              It's an object initializer, which is fully supported in C#, without needing an extra keyword. http://msdn.microsoft.com/en-us/library/bb384062.aspx[^]


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

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

                              D 1 Reply Last reply
                              0
                              • C Colborne_Greg

                                its not a with block, "new image with"

                                P Offline
                                P Offline
                                Pete OHanlon
                                wrote on last edited by
                                #16

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

                                new Image{ Height = 150, Width= 150 }

                                C 1 Reply Last reply
                                0
                                • C Colborne_Greg

                                  no with operator in C#

                                  P Offline
                                  P Offline
                                  Pete OHanlon
                                  wrote on last edited by
                                  #17

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

                                  C K 2 Replies 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
                                    JMK NI
                                    wrote on last edited by
                                    #18

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

                                    C R 2 Replies Last reply
                                    0
                                    • 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
                                      • P Pete OHanlon

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

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

                                        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
                                        • 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
                                          #21

                                          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
                                          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