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 507 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.
  • S Simon_Whale

    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 Offline
    C Offline
    Colborne_Greg
    wrote on last edited by
    #42

    Without the with keyword in C# it reduces the available scope

    1 Reply Last reply
    0
    • K Kenneth Haugland

      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 Offline
      C Offline
      Colborne_Greg
      wrote on last edited by
      #43

      No

      1 Reply Last reply
      0
      • C Colborne_Greg

        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 Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #44

        That may be part of the problem...

        Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        C 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[^]

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

          I should have left out the try catch

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

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

            visual basic takes less skill to get the job done

            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

              N Offline
              N Offline
              Nagy Vilmos
              wrote on last edited by
              #47

              If I could be arsed, I'd find similar classes in Java and show you how anonymous constructors work there too.

              C 1 Reply Last reply
              0
              • Z ZurdoDev

                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 Offline
                C Offline
                Colborne_Greg
                wrote on last edited by
                #48

                visual basic is easier for people with less skill

                S 1 Reply Last reply
                0
                • L Lost User

                  Are you still opposed to using (the namespace one, not the disposing one or the alias one) as well?

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

                  Public Shared Function GetImage(FileName As String) As BitmapImage
                  If FileName <> "" Then
                  Using isStore = IsolatedStorageFile.GetUserStoreForApplication()
                  Using targetStream = isStore.OpenFile(CameraControl.LastKnownTaken.FileName, FileMode.Open, FileAccess.Read)
                  Dim ImageCaptured = New BitmapImage
                  ImageCaptured.SetSource(targetStream)
                  Return ImageCaptured
                  End Using
                  End Using
                  End If
                  Return Nothing
                  End Function

                  1 Reply Last reply
                  0
                  • N Nagy Vilmos

                    If I could be arsed, I'd find similar classes in Java and show you how anonymous constructors work there too.

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

                    not familiar with Java so that would be great

                    1 Reply Last reply
                    0
                    • C Colborne_Greg

                      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.

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

                      My dislike of with (also in Pascal I think) is that the only place I would have liked to use it, it won't work... If I have two things (not necessarily the same type), and I want to copy a number of values (not necessarily all the values) between them:

                      thing1.fieldM = thing2.fieldP ;
                      thing1.fieldD = thing2.fieldQ ;
                      ...

                      I want a with that will allow me to do something like:

                      with ( thing1 , thing2 )
                      {
                      fieldM = fieldP ;
                      fieldD = fieldQ ;
                      ...
                      }

                      That would be usefull. As it stands, with is pointless (in my opinion) so I have never used it. However, one could use something like:

                      {
                      var src = thing1 ;
                      var dst = thing2 ;

                      dst.fieldM = src.fieldP ;
                      dst.fieldD = src.fieldQ ;
                      ...
                      }

                      which is almost a good. :shrug:

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

                      C 1 Reply Last reply
                      0
                      • OriginalGriffO OriginalGriff

                        That may be part of the problem...

                        Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

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

                        What problem? People with less skill are more focused on getting the job done, then writing cool useless code.

                        OriginalGriffO 1 Reply Last reply
                        0
                        • C Colborne_Greg

                          Without the with operator C# has a smaller scope

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

                          Sorry as Bob has pointed out, this sort of argument needs more research. many have also pointed out from the .net framework that C# doesn't need the With keyword. There are many other keywords if you looked and were pedantic enough C# doesn't use but slight change / merge of keywords you could achieve the same thing. relax and enjoy the lounge they don't really care what language you code in.

                          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

                            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

                            M Offline
                            M Offline
                            mikepwilson
                            wrote on last edited by
                            #54

                            Wow. Dude. If you're going to say something like that, make sure you're exposed to more languages first.

                            C 1 Reply Last reply
                            0
                            • C Colborne_Greg

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

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

                              ..and also something that happens quite often in VB. And no, one cannot call it lazy - the author of said snippet included TWO handlers to swallow the exceptions. That's not lazy, that's extra work. It could be improved by simply REMOVING the check completely.

                              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

                                visual basic takes less skill to get the job done

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

                                If it's in VB, it isn't "done". :laugh:

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

                                C 1 Reply Last reply
                                0
                                • C Colborne_Greg

                                  I should have left out the try catch

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

                                  Or handled it.

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

                                  C 1 Reply Last reply
                                  0
                                  • P PIEBALDconsult

                                    My dislike of with (also in Pascal I think) is that the only place I would have liked to use it, it won't work... If I have two things (not necessarily the same type), and I want to copy a number of values (not necessarily all the values) between them:

                                    thing1.fieldM = thing2.fieldP ;
                                    thing1.fieldD = thing2.fieldQ ;
                                    ...

                                    I want a with that will allow me to do something like:

                                    with ( thing1 , thing2 )
                                    {
                                    fieldM = fieldP ;
                                    fieldD = fieldQ ;
                                    ...
                                    }

                                    That would be usefull. As it stands, with is pointless (in my opinion) so I have never used it. However, one could use something like:

                                    {
                                    var src = thing1 ;
                                    var dst = thing2 ;

                                    dst.fieldM = src.fieldP ;
                                    dst.fieldD = src.fieldQ ;
                                    ...
                                    }

                                    which is almost a good. :shrug:

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

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

                                    I would not hire you sorry. The reason you can not use the with operator in such a fashion is scope

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

                                      E Offline
                                      E Offline
                                      ed welch
                                      wrote on last edited by
                                      #59

                                      Nothing against vb, but catching exceptions and then not handling them is epic fail for me, not "beauty and elegance".

                                      C 1 Reply Last reply
                                      0
                                      • L Lost User

                                        ..and also something that happens quite often in VB. And no, one cannot call it lazy - the author of said snippet included TWO handlers to swallow the exceptions. That's not lazy, that's extra work. It could be improved by simply REMOVING the check completely.

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

                                        Most of that code is autocompleted also the inside catch is to ensure the loop continues

                                        L 1 Reply Last reply
                                        0
                                        • E ed welch

                                          Nothing against vb, but catching exceptions and then not handling them is epic fail for me, not "beauty and elegance".

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

                                          Running through a database there are some times bad records. I don't want them crashing the program nor do I care at this point what the problem is

                                          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