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

    No as you would of written it like this VB.NET Version

    New image With
    {
    .height = height
    }

    C# Version, in the C# version the With Keyword is ommited

    new image { height = this.height }

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

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

    Simon_Whale wrote:

    would of have

    FTFY new image**()** { Height = Height } In one small test, I see that the this. isn't required, but it seems to confuse the debugger a bit. I prefer to use this. just because.

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

    1 Reply Last reply
    0
    • M Mycroft Holmes

      I think he is referring to the empty catch, it was my first thought. Oh a new version of resume next :laugh:

      Never underestimate the power of human stupidity RAH

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

      He asked what if pictures were null. It's actually a shared class, and this procedure is only for displaying what is in the system.

      1 Reply Last reply
      0
      • L Lost User

        Colborne_Greg wrote:

        It makes it easier for people that have less or no skill to be more productive

        And that's exactly what raises my expectations whenever someone comes with VB.

        The language is JavaScript. that of Mordor, which I will not utter here
        I hold an A-7 computer expert classification, Commodore. I'm well acquainted with Dr. Daystrom's theories and discoveries. The basic design of all our ship's computers are JavaScript.

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

        I came from Cobol and JCL, with 25 years of experience. I own a start up software company. Anyone that has C experience or web experience I find are bad employees, they make great leaders, not great employees, unless your business in devoted to C and C type languages, then you probably have 20 programmers to my one.

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

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

          PIEBALDconsult wrote:

          Try writing an event that returns a value in VB

          How do you do that in C# that you can't do in VB?

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

          P 1 Reply Last reply
          0
          • L Lost User
                   Catch
                    End Try
                Next
            Catch
            End Try
            

            End Sub

            A rat's tail of different closing elements instead of some simple closing brackets.

            The language is JavaScript. that of Mordor, which I will not utter here
            I hold an A-7 computer expert classification, Commodore. I'm well acquainted with Dr. Daystrom's theories and discoveries. The basic design of all our ship's computers are JavaScript.

            F Offline
            F Offline
            F Xaver
            wrote on last edited by
            #106

            I wouldn't write such empty Try's but.... still I like it over this here ^^

                    }
                 }
              }
            

            }
            }

            and this things aint better...

                } //For
            } //If
            

            } //Try

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

              C Offline
              C Offline
              Chris Quinn
              wrote on last edited by
              #107

              As I frequently say - it's not the tool that is used that's the problem, but the tool that uses it.

              ========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================

              C 1 Reply Last reply
              0
              • F F Xaver

                I wouldn't write such empty Try's but.... still I like it over this here ^^

                        }
                     }
                  }
                

                }
                }

                and this things aint better...

                    } //For
                } //If
                

                } //Try

                S Offline
                S Offline
                SortaCore
                wrote on last edited by
                #108

                I gotta say, I start commenting when there's about 5 or so - generally function, loop, try, subloop, try... a quick phrase about what's being looped or what scope the exceptions are.

                1 Reply Last reply
                0
                • C Colborne_Greg

                  No the problem is when one error exists it kills the loop half way through, this code is only run to display results on the GUI, so not only do I not want it to fail for one error, I don't want it to waste time trying to figure out anything related to that error. I am only unidex the only errors that get through to a client are typos, such as bad filenames

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

                  Colborne_Greg wrote:

                  so not only do I not want it to fail for one error

                  It's wrong. If there's an unexpected error, then the loop should break. That's always better than hiding the exceptions.

                  Colborne_Greg wrote:

                  I don't want it to waste time trying to figure out anything related to that error.

                  You cannot be bothered to check your own code if it reports an error. I would recommend your users to make backups. Very frequent.

                  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

                    G Offline
                    G Offline
                    glennPattonWork3
                    wrote on last edited by
                    #110

                    No, for the love of something NO! It makes writing code easier for those that don't write code. It only exists as some one else pointed out (probably) in reaction to Borland's Delphi (Object Pascal) MS needed to make there Basic compiler have similar features to compete! Bad programmers can write bad code in any language, the language makes it easier (VB) compare to another (C#) but they compile to the same byte code, you can't tell the difference! :)

                    C 1 Reply Last reply
                    0
                    • C Colborne_Greg

                      damn

                      A Offline
                      A Offline
                      Adam Tibi
                      wrote on last edited by
                      #111

                      Haha :)

                      Make it simple, as simple as possible, but not simpler.

                      1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        BobJanova wrote:

                        doing nothing but a bunch of calls to lineTo, moveTo, setBitmapFill etc, and (imo anyway) not having "e.graphics." on every line makes that clearer

                        Howsabout writing a function then? Now I'm wondering wether or not an anomymous function would do that...

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

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

                        The minimum you can have without with would be g.lineTo(), g.moveTo() etc.

                        P 1 Reply Last reply
                        0
                        • C Colborne_Greg

                          VB New image with {.height = height} C# New image {height = height} second one fails

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

                          It does not fail in C#.

                          class DataObj {
                          public int Height { get; set; }
                          }

                          class Starter {
                          public static void Main() {
                          int Height = 23;
                          DataObj obj = new DataObj { Height = Height };
                          System.Console.WriteLine("Set to " + obj.Height);
                          }
                          }

                          Compiles without warnings and gives the right answer. Once again, if you're going to make concrete statements about what is or isn't possible in a language, you need to check whether that statement is accurate first.

                          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

                            A Offline
                            A Offline
                            Adam Tibi
                            wrote on last edited by
                            #114

                            You hang on there my friend and protect our beloved language. I used to be a VB.NET developer back in 2002 then I've seen the light (that would be C#), this is because I played with VB5 and VB6 during high school, because I played with QBasic during my early high school... C# pays more and is more respected by developers and generally the code written in C# tends to be higher quality as the VB.NET code tends to be written by old school guys with less OOP experience than those of C# (I am saying "tends" not all). Advice, move to C#

                            Make it simple, as simple as possible, but not simpler.

                            K C 2 Replies Last reply
                            0
                            • C Colborne_Greg

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

                              Z Offline
                              Z Offline
                              Ziad Elmalki
                              wrote on last edited by
                              #115

                              This is hilarious. This guy is straight out of dailywtf.

                              1 Reply Last reply
                              0
                              • Richard DeemingR Richard Deeming

                                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

                                D Offline
                                D Offline
                                dave dolan
                                wrote on last edited by
                                #116

                                You sir, win the internet.

                                1 Reply Last reply
                                0
                                • C Colborne_Greg

                                  My employee cost vs performance says otherwise

                                  D Offline
                                  D Offline
                                  dave dolan
                                  wrote on last edited by
                                  #117

                                  Really? You have accurate data comparing those using 'with blocks' to those without? Those with C experience to those without? Those who know what a stack frame is compared to those who barely understand what a stack data structure is? Calls inside a 'with block' can either be accessing properties or local variables and it isn't immediately obvious which it is. You have to look up the page to see. Also, you're suppressing exceptions, which, if you're talking about cost of development, means your debugging cycle is a lot more intense because it doesn't blow up when something goes wrong.

                                  C 1 Reply Last reply
                                  0
                                  • A Adam Tibi

                                    You hang on there my friend and protect our beloved language. I used to be a VB.NET developer back in 2002 then I've seen the light (that would be C#), this is because I played with VB5 and VB6 during high school, because I played with QBasic during my early high school... C# pays more and is more respected by developers and generally the code written in C# tends to be higher quality as the VB.NET code tends to be written by old school guys with less OOP experience than those of C# (I am saying "tends" not all). Advice, move to C#

                                    Make it simple, as simple as possible, but not simpler.

                                    K Offline
                                    K Offline
                                    KLPounds
                                    wrote on last edited by
                                    #118

                                    I think the OP needs some credit.. The intestinal fortitude required to even try to hold dialog favoring VB in anyway here is incredible. VB is my first language, partly because I've grown up my whole life under BASIC.. Partly because my first professional programming job was to convert VB6 to VB.NET and nearly every job since has required VB in one way or another. Who am I to question my employer on the politics of language? Who am I do judge my employer based on their chosen language? I pulled the trigger and learned C# and have projects I still maintain. Its different, but it works and it makes me more marketable to be able to work in both. Right now, VB.NET is the required language and is what pays my bills. When it comes to new projects where language isn't a requirement I find that any classic WinForm or windows service projects stay in VB but I aim to use C# for anything else if possible. Is C# still "the better language" if my code pattern mimics VB.NET concepts? Of course, regardless of right or wrong, it's still not VB. Is VB.NET any better of a language if my code pattern mimics C# concepts? Doubtful, because it's still VB.. I don't buy into this culture.

                                    1 Reply Last reply
                                    0
                                    • B BobJanova

                                      The minimum you can have without with would be g.lineTo(), g.moveTo() etc.

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

                                      Yep, looks good to me.

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

                                      1 Reply Last reply
                                      0
                                      • D dave dolan

                                        Really? You have accurate data comparing those using 'with blocks' to those without? Those with C experience to those without? Those who know what a stack frame is compared to those who barely understand what a stack data structure is? Calls inside a 'with block' can either be accessing properties or local variables and it isn't immediately obvious which it is. You have to look up the page to see. Also, you're suppressing exceptions, which, if you're talking about cost of development, means your debugging cycle is a lot more intense because it doesn't blow up when something goes wrong.

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

                                        The entire difference between C# and VB are involved in that factoring, suppressing exceptions is not an acceptable thing for my employee's to do, suppressing exceptions happens by my efficiency team; who decided that at this moment didn't need to know the error. In visual basic with block

                                                With CameraControl.LastKnownTaken
                                                    DateTakenBlock.Text = .DateTaken
                                                    FileNameBlock.Text = .FileName
                                                    LatitudeBlock.Text = .Latitude
                                                    LongitudeBlock.Text = .Longitude 
                                                End With 
                                        

                                        notice the period, if you cant figure out that the words with a period before them belong to the with block I wouldn't hire you

                                        D L 2 Replies Last reply
                                        0
                                        • A Adam Tibi

                                          You hang on there my friend and protect our beloved language. I used to be a VB.NET developer back in 2002 then I've seen the light (that would be C#), this is because I played with VB5 and VB6 during high school, because I played with QBasic during my early high school... C# pays more and is more respected by developers and generally the code written in C# tends to be higher quality as the VB.NET code tends to be written by old school guys with less OOP experience than those of C# (I am saying "tends" not all). Advice, move to C#

                                          Make it simple, as simple as possible, but not simpler.

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

                                          Visual basic 2013 is better then 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