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. General Programming
  3. Visual Basic
  4. Subclass a Control by UserControl

Subclass a Control by UserControl

Scheduled Pinned Locked Moved Visual Basic
questioncsharpvisual-studiohardware
32 Posts 9 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.
  • S Samir Ibrahim 0

    You know something? It became hard for someone to ask simple question and he got an answer without the person who answer the question show his arrogance and he know to much and he reads a lot of books and all should do as he did. well, I have something to say to you, I am not a beginner, I know classing and subclassing more than you can imagine. 6 month of learning vb.net and i finished my first sql server vb.net application and my company work on it now. Search for "imdb dll" or "imdb.dll" in google, it is a dll based on class i create it. I was in top contributor in many vfp forums, and i am giving help in vb.net forums as well. It seem the person should be as***le and super arrogance in order to get some respect. -if Return Version is wrong then this is bu***hit design -If Every Property should be replaced by a variable, that is bu***hit design -If creating a UserControl and put some coding in it, and then drag this Usercontrol to a form and the code written in the UserControl design being executed in the form, well if that is not subclassing I wonder what it is.

    Dave Kreskowiak wrote:

    pick up a beginners book on VB.NET

    I will follow your advice and get a beginner vb.net book plus a milk biberon I had enough of asking help in here. Thanks.

    Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

    J Offline
    J Offline
    Jerry Hammond
    wrote on last edited by
    #12

    Samir-- If you think Dave's answer was arrogant because of how spot on it was (meaning that it is completely correct), then I suggest you have no business getting into the programming profession. You should get involved in a touchy-feely business like fast food, or car lot boy where a lack of knowledge about your chosen profession has no bearing on your ability to excecute your professional skills. Otherwise, suck it up and learn. This isn't a freaking prep school for pampered children. Good luck and I wish you well.

    The world is a stage and most of us are desperately unrehearsed. —Sean O’Casey, Playwright

    S 1 Reply Last reply
    0
    • D Dave Kreskowiak

      Samir Ibrahim wrote:

      You know something? It became hard for someone to ask simple question and he got an answer without the person who answer the question show his arrogance and he know to much and he reads a lot of books and all should do as he did. well, I have something to say to you, I am not a beginner, I know classing and subclassing more than you can imagine. 6 month of learning vb.net and i finished my first sql server vb.net application and my company work on it now. Search for "imdb dll" or "imdb.dll" in google, it is a dll based on class i create it. I was in top contributor in many vfp forums, and i am giving help in vb.net forums as well. It seem the person should be as***le and super arrogance in order to get some respect.

      :wtf: Excuse me, but where was I "super arrogant"?? I'm not out here try to grab respect. I'm out here trying to help people WHO WANT IT. IMHO, it's your response here that is "super arrogant". I pointed out that you don't have a basic understanding of how Properties work, which is beginner-level knowledge. If you can't accept that, I'll just throw you on my blacklist of people I'll never help again.

      Samir Ibrahim wrote:

      -if Return Version is wrong then this is bu***hit design

      Excuse me, but you wrote that code, not me. If you want to say that VB.NET's syntactic requirements are bullshit, go back to writing VFP code...

      Samir Ibrahim wrote:

      -If Every Property should be replaced by a variable, that is bu***hit design

      I never said that. Every property has to support either a Gettor, a Settor, or both. Either/Both of which much be backed by a constant, a variable, or some other storage, to make the property usefull. If you understood the basics of Properties, you never would have said what you did.

      Samir Ibrahim wrote:

      -If creating a UserControl and put some coding in it, and then drag this Usercontrol to a form and the code written in the UserControl design being executed in the form, well if that is not subclassing I wonder what it is.

      I never said that wasn't subclassing. I said the problem you have in your code HAS NOTHING TO DO WITH SUBCLASSING.

      Samir Ibrahim wrote:

      I will follow your advice and get a beginner vb.net book plus a milk biberon I

      S Offline
      S Offline
      Samir Ibrahim 0
      wrote on last edited by
      #13

      Dave Kreskowiak wrote:

      I'm not out here try to grab respect

      Maybe/Maybe not. But you got mine.

      Dave Kreskowiak wrote:

      I pointed out that you don't have a basic understanding of how Properties work

      I know how property work and should work. I just HATE how property work in vb.net

      Dave Kreskowiak wrote:

      Samir Ibrahim wrote: -if Return Version is wrong then this is bu***hit design Excuse me, but you wrote that code

      Yes I write that code in my app and it gives error which is not logical error in my understanding of how PEM's should work in a class. I did not say you write that neither you mention it. That was an expression of my thought.

      Dave Kreskowiak wrote:

      I said the problem you have in your code HAS NOTHING TO DO WITH SUBCLASSING.

      What/Where is my problem in my code? Did you notice the remark ' I put in front of the lines? did you notice the remark I put after the ' "works fine" or "gives warning", I managed to make the property work before I ask this question. I read and search google and reading in 3 books and when I sleep and I dream That I am searching google. All I was asking is "Why it is giving warning" It's hard to threw 15 years of "any Language" experience behind your back and start learning new language from scratch. In my stupid mind, when you are working in class and you code Me.Version or just Version, LOGICALLY they both should point to the same property. Yes I find that not logical and has no reason to give error. Eventually, You was right. I DON'T UNDERSTAND HOW PROPERTY WORK IN VB.NET The capital letter is for emphasizing not shouting.

      Dave Kreskowiak wrote:

      Excuse me, but where was I "super arrogant"??

      I had one point to fix about "as***le and super arrogance" I did not mean to say that about you, I am saying that about the Post Owner PO. although after reading my post it seems like it is towards you. Sorry for that, A thought in mind translated in wrong way. please accept my apology. In short, 15 years programming experience, I cannot accept "read beginner book" as an answer, but I can accept "Vb.net Work Like that either you like or no" I am feeling nervous and upset from my self not from you. Sorry. <

      N D 2 Replies Last reply
      0
      • S Samir Ibrahim 0

        Dave Kreskowiak wrote:

        I'm not out here try to grab respect

        Maybe/Maybe not. But you got mine.

        Dave Kreskowiak wrote:

        I pointed out that you don't have a basic understanding of how Properties work

        I know how property work and should work. I just HATE how property work in vb.net

        Dave Kreskowiak wrote:

        Samir Ibrahim wrote: -if Return Version is wrong then this is bu***hit design Excuse me, but you wrote that code

        Yes I write that code in my app and it gives error which is not logical error in my understanding of how PEM's should work in a class. I did not say you write that neither you mention it. That was an expression of my thought.

        Dave Kreskowiak wrote:

        I said the problem you have in your code HAS NOTHING TO DO WITH SUBCLASSING.

        What/Where is my problem in my code? Did you notice the remark ' I put in front of the lines? did you notice the remark I put after the ' "works fine" or "gives warning", I managed to make the property work before I ask this question. I read and search google and reading in 3 books and when I sleep and I dream That I am searching google. All I was asking is "Why it is giving warning" It's hard to threw 15 years of "any Language" experience behind your back and start learning new language from scratch. In my stupid mind, when you are working in class and you code Me.Version or just Version, LOGICALLY they both should point to the same property. Yes I find that not logical and has no reason to give error. Eventually, You was right. I DON'T UNDERSTAND HOW PROPERTY WORK IN VB.NET The capital letter is for emphasizing not shouting.

        Dave Kreskowiak wrote:

        Excuse me, but where was I "super arrogant"??

        I had one point to fix about "as***le and super arrogance" I did not mean to say that about you, I am saying that about the Post Owner PO. although after reading my post it seems like it is towards you. Sorry for that, A thought in mind translated in wrong way. please accept my apology. In short, 15 years programming experience, I cannot accept "read beginner book" as an answer, but I can accept "Vb.net Work Like that either you like or no" I am feeling nervous and upset from my self not from you. Sorry. <

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

        Samir Ibrahim wrote:

        It's hard to threw 15 years of "any Language" experience behind your back and start learning new language from scratch

        Okay Doofus, explain why, if your elite skills are so good, you are asking why writing a function (forget that it's a property for the moment) without returning a value causes a compiler warning that there is no value returned? Let's go back to OO school: Getter methods are used to RETURN a value without changing anything. Setter methods are used to CHANGE a value without returning anything. Which bit do you not understand? This is NOT VB.Net nor M$, it's first principles.


        Panic, Chaos, Destruction. My work here is done.

        S 1 Reply Last reply
        0
        • N Nagy Vilmos

          Okay, Dave and Ellain have been nice to you. I won't be: Your code example was sh!t. Your knowledge of OO principles is w!nk. A rabid monkey knows more than you. Is that clear enough or do you need it carved on stone and shoved up your manky a...?


          Panic, Chaos, Destruction. My work here is done.

          S Offline
          S Offline
          Samir Ibrahim 0
          wrote on last edited by
          #15

          Normally, When you have question in forums, and you have an answer, say it. otherwise it is much better to stay quite and play a game such Monkey Island if you love monkeys that much. I refuse the answer of "read books" because I am reading 3, and "search google" because I do. Should I read the 550 pages of books just to know that the answer to my question is "No, That cannot be done". I would like to know your answer about my

          williamnw wrote:

          w!nk

          OO question .

          williamnw wrote:

          Your code example was sh!t.

          That example is working fine. Make a good statement so I can comment on it.

          Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

          1 Reply Last reply
          0
          • N Nagy Vilmos

            You really are a muckfit aren't you! You say thanks for a little and rant at a lot.


            Panic, Chaos, Destruction. My work here is done.

            S Offline
            S Offline
            Samir Ibrahim 0
            wrote on last edited by
            #16

            If you can read and understand, you will know that I am trying to end this post and end this discussion. but it seem you don't.

            Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

            1 Reply Last reply
            0
            • J Jerry Hammond

              Samir-- If you think Dave's answer was arrogant because of how spot on it was (meaning that it is completely correct), then I suggest you have no business getting into the programming profession. You should get involved in a touchy-feely business like fast food, or car lot boy where a lack of knowledge about your chosen profession has no bearing on your ability to excecute your professional skills. Otherwise, suck it up and learn. This isn't a freaking prep school for pampered children. Good luck and I wish you well.

              The world is a stage and most of us are desperately unrehearsed. —Sean O’Casey, Playwright

              S Offline
              S Offline
              Samir Ibrahim 0
              wrote on last edited by
              #17

              Jerry Hammond wrote:

              If you think Dave's answer was arrogant because of how spot on it was (meaning that it is completely correct), then I suggest you have no business getting into the programming profession.

              Please read my last reply to Dave, I translate an idea in my mind in wrong words.

              Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

              1 Reply Last reply
              0
              • S Samir Ibrahim 0

                You know something? It became hard for someone to ask simple question and he got an answer without the person who answer the question show his arrogance and he know to much and he reads a lot of books and all should do as he did. well, I have something to say to you, I am not a beginner, I know classing and subclassing more than you can imagine. 6 month of learning vb.net and i finished my first sql server vb.net application and my company work on it now. Search for "imdb dll" or "imdb.dll" in google, it is a dll based on class i create it. I was in top contributor in many vfp forums, and i am giving help in vb.net forums as well. It seem the person should be as***le and super arrogance in order to get some respect. -if Return Version is wrong then this is bu***hit design -If Every Property should be replaced by a variable, that is bu***hit design -If creating a UserControl and put some coding in it, and then drag this Usercontrol to a form and the code written in the UserControl design being executed in the form, well if that is not subclassing I wonder what it is.

                Dave Kreskowiak wrote:

                pick up a beginners book on VB.NET

                I will follow your advice and get a beginner vb.net book plus a milk biberon I had enough of asking help in here. Thanks.

                Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

                realJSOPR Offline
                realJSOPR Offline
                realJSOP
                wrote on last edited by
                #18

                Samir Ibrahim wrote:

                6 month of learning vb.net

                Six months of "learning VB.net" makes you a rank amateur, a newbie, a mere child. It took me ten years to get to a point where I felt comfortable in my knowledge of C++. I've been doing C# for just two years (about 7 years less than almost everyone else here), and while I feel pretty comfortable with it, I wouldn't call myself "accomplished". And while I realize that this is the VB forum, saying you code in VB is like admitting you use AOL to get on the internet.

                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                -----
                "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                J S 3 Replies Last reply
                0
                • N Nagy Vilmos

                  Samir Ibrahim wrote:

                  It's hard to threw 15 years of "any Language" experience behind your back and start learning new language from scratch

                  Okay Doofus, explain why, if your elite skills are so good, you are asking why writing a function (forget that it's a property for the moment) without returning a value causes a compiler warning that there is no value returned? Let's go back to OO school: Getter methods are used to RETURN a value without changing anything. Setter methods are used to CHANGE a value without returning anything. Which bit do you not understand? This is NOT VB.Net nor M$, it's first principles.


                  Panic, Chaos, Destruction. My work here is done.

                  S Offline
                  S Offline
                  Samir Ibrahim 0
                  wrote on last edited by
                  #19

                  williamnw wrote:

                  you are asking why writing a function (forget that it's a property for the moment) without returning a value causes a compiler warning that there is no value returned?

                  Where I mention that I am not returning a value for the function? show me. here is my question

                  Public Class myclass1
                  Function Sum()
                  Sum = 1 + 2 ' <-- Works Fine
                  Me.Sum = 1 + 2 ' <-- Gives error although me.Sum should be the same as Sum alone
                  End Function
                  End Class

                  Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

                  N D 2 Replies Last reply
                  0
                  • S Samir Ibrahim 0

                    Dave Kreskowiak wrote:

                    I'm not out here try to grab respect

                    Maybe/Maybe not. But you got mine.

                    Dave Kreskowiak wrote:

                    I pointed out that you don't have a basic understanding of how Properties work

                    I know how property work and should work. I just HATE how property work in vb.net

                    Dave Kreskowiak wrote:

                    Samir Ibrahim wrote: -if Return Version is wrong then this is bu***hit design Excuse me, but you wrote that code

                    Yes I write that code in my app and it gives error which is not logical error in my understanding of how PEM's should work in a class. I did not say you write that neither you mention it. That was an expression of my thought.

                    Dave Kreskowiak wrote:

                    I said the problem you have in your code HAS NOTHING TO DO WITH SUBCLASSING.

                    What/Where is my problem in my code? Did you notice the remark ' I put in front of the lines? did you notice the remark I put after the ' "works fine" or "gives warning", I managed to make the property work before I ask this question. I read and search google and reading in 3 books and when I sleep and I dream That I am searching google. All I was asking is "Why it is giving warning" It's hard to threw 15 years of "any Language" experience behind your back and start learning new language from scratch. In my stupid mind, when you are working in class and you code Me.Version or just Version, LOGICALLY they both should point to the same property. Yes I find that not logical and has no reason to give error. Eventually, You was right. I DON'T UNDERSTAND HOW PROPERTY WORK IN VB.NET The capital letter is for emphasizing not shouting.

                    Dave Kreskowiak wrote:

                    Excuse me, but where was I "super arrogant"??

                    I had one point to fix about "as***le and super arrogance" I did not mean to say that about you, I am saying that about the Post Owner PO. although after reading my post it seems like it is towards you. Sorry for that, A thought in mind translated in wrong way. please accept my apology. In short, 15 years programming experience, I cannot accept "read beginner book" as an answer, but I can accept "Vb.net Work Like that either you like or no" I am feeling nervous and upset from my self not from you. Sorry. <

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #20

                    Samir Ibrahim wrote:

                    I know how property work and should work. I just HATE how property work in vb.net

                    I works exactly the same as it does in any .NET lanuage, be it Managed C++, C#, VB.NET, ... It's very standard and doesn't deviate from accepted norms in other languages outside the .NET environment. So, I fail to understand how you find the functionality or structure of a VB.NET Property weird.

                    Samir Ibrahim wrote:

                    I cannot accept "read beginner book" as an answer

                    There are other uses for books like that, such as being a reference when converting code/concepts from other languages to VB.NET. Yeah, I saw all the ' marks in your code snippet. It looked as though you were guessing, trying to figure out how properties worked. Properties are a very basic concept in .NET, so that's why the book suggestion. The rest, I'm not going to touch.

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007, 2008

                    1 Reply Last reply
                    0
                    • realJSOPR realJSOP

                      Samir Ibrahim wrote:

                      6 month of learning vb.net

                      Six months of "learning VB.net" makes you a rank amateur, a newbie, a mere child. It took me ten years to get to a point where I felt comfortable in my knowledge of C++. I've been doing C# for just two years (about 7 years less than almost everyone else here), and while I feel pretty comfortable with it, I wouldn't call myself "accomplished". And while I realize that this is the VB forum, saying you code in VB is like admitting you use AOL to get on the internet.

                      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                      -----
                      "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                      J Offline
                      J Offline
                      Jon_Boy
                      wrote on last edited by
                      #21

                      John Simmons / outlaw programmer wrote:

                      saying you code in VB is like admitting you use AOL to get on the internet.

                      Hey now, I can understand bashing the OP, but the rest of us? Back when <= VS6, I would agree with you; but with the CLR/CLS, does it really matter what you use to 'develop' with these days (other than fitting in with the C# norm)?

                      Any suggestions, ideas, or 'constructive criticism' are always welcome. "There's no such thing as a stupid question, only stupid people." - Mr. Garrison

                      realJSOPR 1 Reply Last reply
                      0
                      • realJSOPR realJSOP

                        Samir Ibrahim wrote:

                        6 month of learning vb.net

                        Six months of "learning VB.net" makes you a rank amateur, a newbie, a mere child. It took me ten years to get to a point where I felt comfortable in my knowledge of C++. I've been doing C# for just two years (about 7 years less than almost everyone else here), and while I feel pretty comfortable with it, I wouldn't call myself "accomplished". And while I realize that this is the VB forum, saying you code in VB is like admitting you use AOL to get on the internet.

                        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                        -----
                        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                        S Offline
                        S Offline
                        Samir Ibrahim 0
                        wrote on last edited by
                        #22

                        You have 10 years experience in C++, 2 years in C# Since the algorithm and principals (thinking of solving the problem) is the same almost in all language. can you compare your self for learning let say "Delphi" with someone who has no programming experience at all?

                        Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

                        realJSOPR N 2 Replies Last reply
                        0
                        • J Jon_Boy

                          John Simmons / outlaw programmer wrote:

                          saying you code in VB is like admitting you use AOL to get on the internet.

                          Hey now, I can understand bashing the OP, but the rest of us? Back when <= VS6, I would agree with you; but with the CLR/CLS, does it really matter what you use to 'develop' with these days (other than fitting in with the C# norm)?

                          Any suggestions, ideas, or 'constructive criticism' are always welcome. "There's no such thing as a stupid question, only stupid people." - Mr. Garrison

                          realJSOPR Offline
                          realJSOPR Offline
                          realJSOP
                          wrote on last edited by
                          #23

                          Jon_Boy wrote:

                          Hey now, I can understand bashing the OP, but the rest of us?

                          I am an equal-opportunity abuser.

                          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                          -----
                          "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                          J 1 Reply Last reply
                          0
                          • S Samir Ibrahim 0

                            williamnw wrote:

                            you are asking why writing a function (forget that it's a property for the moment) without returning a value causes a compiler warning that there is no value returned?

                            Where I mention that I am not returning a value for the function? show me. here is my question

                            Public Class myclass1
                            Function Sum()
                            Sum = 1 + 2 ' <-- Works Fine
                            Me.Sum = 1 + 2 ' <-- Gives error although me.Sum should be the same as Sum alone
                            End Function
                            End Class

                            Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

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

                            0. No question, just a statement. 1. the first line is assigning the value that will be returned:

                            Samir Ibrahim wrote:

                            Sum = 1 + 2 ' <-- Works Fine

                            2. The second line is trying to assign a new value to the what would be returned:

                            Samir Ibrahim wrote:

                            Me.Sum = 1 + 2 ' <-- Gives error although me.Sum should be the same as Sum alone

                            Your whole reference point is wrong. With every post you are showing more ignorance and less ability. These are not new concepts, they have not changed for a long time. The example given, with a bit of editing, wouldn't have worked in any version of VB since classes came in in VB4 You failed to ask a very basic question. When given the best possible answer you ranted back. In summing up My Lord, I submit that the defendant is indeed a Doofus and should be shown no mercy. The case for the prosecution rests.


                            Panic, Chaos, Destruction. My work here is done.

                            1 Reply Last reply
                            0
                            • S Samir Ibrahim 0

                              You have 10 years experience in C++, 2 years in C# Since the algorithm and principals (thinking of solving the problem) is the same almost in all language. can you compare your self for learning let say "Delphi" with someone who has no programming experience at all?

                              Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

                              realJSOPR Offline
                              realJSOPR Offline
                              realJSOP
                              wrote on last edited by
                              #25

                              Samir Ibrahim wrote:

                              You have 10 years experience in C++, 2 years in C#

                              No, I have 18 years in C++, 2 in C#, 8 in Pascal, and a number of years in more obscure languages on systems that were not PCs. I've been programming for a living for 30 years.

                              Samir Ibrahim wrote:

                              Since the algorithm and principals (thinking of solving the problem) is the same almost in all language.

                              Old news - I discovered that in 1981.

                              Samir Ibrahim wrote:

                              can you compare your self for learning let say "Delphi" with someone who has no programming experience at all?

                              Delphi is Pascal, so no, I can't compare the two since I already know Pascal. What point are you failing to make?

                              "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                              -----
                              "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                              1 Reply Last reply
                              0
                              • S Samir Ibrahim 0

                                You have 10 years experience in C++, 2 years in C# Since the algorithm and principals (thinking of solving the problem) is the same almost in all language. can you compare your self for learning let say "Delphi" with someone who has no programming experience at all?

                                Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

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

                                Speaking for myself, I doubt I would make such a fundamental mistake.


                                Panic, Chaos, Destruction. My work here is done.

                                1 Reply Last reply
                                0
                                • realJSOPR realJSOP

                                  Samir Ibrahim wrote:

                                  6 month of learning vb.net

                                  Six months of "learning VB.net" makes you a rank amateur, a newbie, a mere child. It took me ten years to get to a point where I felt comfortable in my knowledge of C++. I've been doing C# for just two years (about 7 years less than almost everyone else here), and while I feel pretty comfortable with it, I wouldn't call myself "accomplished". And while I realize that this is the VB forum, saying you code in VB is like admitting you use AOL to get on the internet.

                                  "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                                  -----
                                  "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                                  S Offline
                                  S Offline
                                  Samir Ibrahim 0
                                  wrote on last edited by
                                  #27

                                  John Simmons / outlaw programmer wrote:

                                  Six months of "learning VB.net" makes you a rank amateur, a newbie, a mere child

                                  I agree 100%. Who said that I want from you to consider me an expert? Just take into consideration my programming experience because it make a lot of difference from dealing with no experience.

                                  Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

                                  1 Reply Last reply
                                  0
                                  • realJSOPR realJSOP

                                    Jon_Boy wrote:

                                    Hey now, I can understand bashing the OP, but the rest of us?

                                    I am an equal-opportunity abuser.

                                    "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                                    -----
                                    "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                                    J Offline
                                    J Offline
                                    Jon_Boy
                                    wrote on last edited by
                                    #28

                                    John Simmons wrote:

                                    I am an equal-opportunity abuser.

                                    Jon-boy lowers his head and prepares to be clubbed for his deep rooted love of VB.

                                    Any suggestions, ideas, or 'constructive criticism' are always welcome. "There's no such thing as a stupid question, only stupid people." - Mr. Garrison

                                    1 Reply Last reply
                                    0
                                    • N Nagy Vilmos

                                      Okay, Dave and Ellain have been nice to you. I won't be: Your code example was sh!t. Your knowledge of OO principles is w!nk. A rabid monkey knows more than you. Is that clear enough or do you need it carved on stone and shoved up your manky a...?


                                      Panic, Chaos, Destruction. My work here is done.

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

                                      *cough* name is Elliott, not Ellain *cough*

                                      Check out the CodeProject forum Guidelines[^]

                                      N 1 Reply Last reply
                                      0
                                      • L Lost User

                                        *cough* name is Elliott, not Ellain *cough*

                                        Check out the CodeProject forum Guidelines[^]

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

                                        I wouldn't call Trollslayer Elliot as she'd scratch me.


                                        Panic, Chaos, Destruction. My work here is done.

                                        1 Reply Last reply
                                        0
                                        • S Samir Ibrahim 0

                                          williamnw wrote:

                                          you are asking why writing a function (forget that it's a property for the moment) without returning a value causes a compiler warning that there is no value returned?

                                          Where I mention that I am not returning a value for the function? show me. here is my question

                                          Public Class myclass1
                                          Function Sum()
                                          Sum = 1 + 2 ' <-- Works Fine
                                          Me.Sum = 1 + 2 ' <-- Gives error although me.Sum should be the same as Sum alone
                                          End Function
                                          End Class

                                          Like car accidents, most hardware problems are due to driver error. Samir R. Ibrahim

                                          D Offline
                                          D Offline
                                          Dave Kreskowiak
                                          wrote on last edited by
                                          #31

                                          Public Class myclass1
                                          ' It's "best practice" to explicitly declare visibility of the Function and to
                                          ' define it's return type if you're not using LINQ, or some other technology
                                          ' that will try to imply the return type for you based on possible values that
                                          ' the code might return.
                                          Public Function Sum() As Integer
                                          ' You haven't defined Sum anywhere, except as a function name. VB6 supported just
                                          ' treating the function name as the return value holder. You should NOT be using
                                          ' practice in VB.NET. It is only there for backward compatibility with converted
                                          ' VB6 code.
                                          Sum = 1 + 2 ' <-- Works Fine

                                              ' Now you're treating Sum not as a variable, as in the previous line, but as an object
                                              ' or property.  This will not work since Sum, outside of it's own code, cannot be
                                              ' as a variable since, in true OOP, it's a method name.
                                              Me.Sum = 1 + 2  ' <-- Gives error although me.Sum should be the same as Sum alone
                                          
                                              ' It is considered "best practice" to explicitly declare a single Return statement.
                                              Return x
                                           End Function
                                          

                                          End Class

                                          Serisouly, VB6 and VFP have taught you some very bad habits that are not supported in the true OOP world of VB.NET. I still highly recommend picking up a book on VB.NET so you can learn how the basics are really supposed to work, instead of the garbage VFP taught you.

                                          A guide to posting questions on CodeProject[^]
                                          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                                               2006, 2007, 2008

                                          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