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

    Hi all in VFP, When I begin to work with a project, I create control that is a subclass of it is baseclass, then I code what I want to this subclass, then I drag it and put it on the form. and I use this subclass in all my forms later on. Now to make that in vb.net I found the UserControl is the closet control to do what I want. Q1: Is UserControl is the right direction to achieve what I want? I have did some tests on UserControl and I have these questions 1- Why it gives warning in 'Me.Version = "1.0" 2- Why it gives warning and my vb crashes and could not be restarted unless I close all vb IDE's in Version = value 3- Should I assign a new variable (m_version) for each property I want to add? Cannot I work directly with property? 4- When I drag the control to my form, I notice that the control (Textbox) (width and height) are not expanded to take the the Length and Height of the Usercontrol. Should I handle that manually? 5- I have included many code in the Get, so I would like to know what is the best I should use.

    Public Class UserControl1 ' I add Textbox
    Dim m_Version
    Property Version()
    Get
    'Version = "1.0" ' Worked Fine
    'Me.Version = "1.0" ' Warning 3 Property 'Version' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
    'Return "1.0" ' Worked Fine
    Return m_Version ' Worked Fine
    End Get
    Set(ByVal value)
    m_Version = value ' Works Fine
    'Version = value ' Warning 3 Expression recursively calls the containing property 'Version'.
    End Set
    End Property
    End Class

    TIA

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

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

    Case sensativity, Version is a property and you're using it as a variable, so Version = value wouldn't work, I'm assuming your Version property is referencing m_Version, a private variable that the property Version reflects on.

    Samir Ibrahim wrote:

    'Me.Version = "1.0" ' Warning 3 Property 'Version' doesn't return a value on all code paths.

    will not work, nor should it, you should use Return m_Version which is your private variable Consider the property Version as an interface to your m_Version variable, you do not change the Property but merely what the Property reflects.

    Check out the CodeProject forum Guidelines[^]

    S 1 Reply Last reply
    0
    • S Samir Ibrahim 0

      Hi all in VFP, When I begin to work with a project, I create control that is a subclass of it is baseclass, then I code what I want to this subclass, then I drag it and put it on the form. and I use this subclass in all my forms later on. Now to make that in vb.net I found the UserControl is the closet control to do what I want. Q1: Is UserControl is the right direction to achieve what I want? I have did some tests on UserControl and I have these questions 1- Why it gives warning in 'Me.Version = "1.0" 2- Why it gives warning and my vb crashes and could not be restarted unless I close all vb IDE's in Version = value 3- Should I assign a new variable (m_version) for each property I want to add? Cannot I work directly with property? 4- When I drag the control to my form, I notice that the control (Textbox) (width and height) are not expanded to take the the Length and Height of the Usercontrol. Should I handle that manually? 5- I have included many code in the Get, so I would like to know what is the best I should use.

      Public Class UserControl1 ' I add Textbox
      Dim m_Version
      Property Version()
      Get
      'Version = "1.0" ' Worked Fine
      'Me.Version = "1.0" ' Warning 3 Property 'Version' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
      'Return "1.0" ' Worked Fine
      Return m_Version ' Worked Fine
      End Get
      Set(ByVal value)
      m_Version = value ' Works Fine
      'Version = value ' Warning 3 Expression recursively calls the containing property 'Version'.
      End Set
      End Property
      End Class

      TIA

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

      Samir Ibrahim wrote:

      1- Why it gives warning in 'Me.Version = "1.0"

      Because the Get part of the property must return a value to the caller and your code apparently doesn't do that. Since a Version property should never be set by a caller, your code should read, as a ReadOnly property:

      Public Class MyControl
      Private Const m_Version As String = "1.0"
      Public ReadOnly Property Version() As String
      Get
      Return m_Version
      End Get
      End Property
      End Class

      Seriously, pick up a beginners book on VB.NET. The problem you're having has nothing to do with subclassing or anything of the sort. You're missing a basic understanding of how Properties work.

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

      S 1 Reply Last reply
      0
      • S Samir Ibrahim 0

        Hi all in VFP, When I begin to work with a project, I create control that is a subclass of it is baseclass, then I code what I want to this subclass, then I drag it and put it on the form. and I use this subclass in all my forms later on. Now to make that in vb.net I found the UserControl is the closet control to do what I want. Q1: Is UserControl is the right direction to achieve what I want? I have did some tests on UserControl and I have these questions 1- Why it gives warning in 'Me.Version = "1.0" 2- Why it gives warning and my vb crashes and could not be restarted unless I close all vb IDE's in Version = value 3- Should I assign a new variable (m_version) for each property I want to add? Cannot I work directly with property? 4- When I drag the control to my form, I notice that the control (Textbox) (width and height) are not expanded to take the the Length and Height of the Usercontrol. Should I handle that manually? 5- I have included many code in the Get, so I would like to know what is the best I should use.

        Public Class UserControl1 ' I add Textbox
        Dim m_Version
        Property Version()
        Get
        'Version = "1.0" ' Worked Fine
        'Me.Version = "1.0" ' Warning 3 Property 'Version' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
        'Return "1.0" ' Worked Fine
        Return m_Version ' Worked Fine
        End Get
        Set(ByVal value)
        m_Version = value ' Works Fine
        'Version = value ' Warning 3 Expression recursively calls the containing property 'Version'.
        End Set
        End Property
        End Class

        TIA

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

        J Offline
        J Offline
        Jarno Burger
        wrote on last edited by
        #4

        Errr , i dont know alot , but sound like subclassing/inheritance.. Me.Version = "1.0" is a setter thingie in this class, you are setting version to 1 , that will set property version to 1 , that will set version to 1 etc.. Version = value is also a setter thingie in this class. -did you ever type mybase in your subclass ? use and abuse ! -if you have a inherited control , then this class uses a already made class , maybe you'll have to dive into private/protected/public/must overidde/overiddes stuff..It's weird in the beginning but extremely helpfull in the end. -did you put your usercontrol in a different project and referenced that project into your inheritee project , (cause that how it works with me here) ? A usercontrol sometimes wants to be build first in a seperate project , before it wants to be patched up with new code by a different project.

        Jarno Burger Video Jockey

        S 1 Reply Last reply
        0
        • D Dave Kreskowiak

          Samir Ibrahim wrote:

          1- Why it gives warning in 'Me.Version = "1.0"

          Because the Get part of the property must return a value to the caller and your code apparently doesn't do that. Since a Version property should never be set by a caller, your code should read, as a ReadOnly property:

          Public Class MyControl
          Private Const m_Version As String = "1.0"
          Public ReadOnly Property Version() As String
          Get
          Return m_Version
          End Get
          End Property
          End Class

          Seriously, pick up a beginners book on VB.NET. The problem you're having has nothing to do with subclassing or anything of the sort. You're missing a basic understanding of how Properties work.

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

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

          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

          D L N J realJSOPR 5 Replies Last reply
          0
          • L Lost User

            Case sensativity, Version is a property and you're using it as a variable, so Version = value wouldn't work, I'm assuming your Version property is referencing m_Version, a private variable that the property Version reflects on.

            Samir Ibrahim wrote:

            'Me.Version = "1.0" ' Warning 3 Property 'Version' doesn't return a value on all code paths.

            will not work, nor should it, you should use Return m_Version which is your private variable Consider the property Version as an interface to your m_Version variable, you do not change the Property but merely what the Property reflects.

            Check out the CodeProject forum Guidelines[^]

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

            Thank you. Appreciated your answer.

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

            1 Reply Last reply
            0
            • J Jarno Burger

              Errr , i dont know alot , but sound like subclassing/inheritance.. Me.Version = "1.0" is a setter thingie in this class, you are setting version to 1 , that will set property version to 1 , that will set version to 1 etc.. Version = value is also a setter thingie in this class. -did you ever type mybase in your subclass ? use and abuse ! -if you have a inherited control , then this class uses a already made class , maybe you'll have to dive into private/protected/public/must overidde/overiddes stuff..It's weird in the beginning but extremely helpfull in the end. -did you put your usercontrol in a different project and referenced that project into your inheritee project , (cause that how it works with me here) ? A usercontrol sometimes wants to be build first in a seperate project , before it wants to be patched up with new code by a different project.

              Jarno Burger Video Jockey

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

              Thank you for your answer. Appreciated.

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

              N 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

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

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

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

                  Samir Ibrahim wrote:

                  I know classing and subclassing more than you can imagine

                  Samir Ibrahim wrote:

                  6 month of learning vb.net

                  My career is a mix of low level embedded, hardware and software overy thirty years and there is a lot I can learn from Dave. His point was valid.

                  Visit http://www.notreadytogiveup.com/[^] and do something special today.

                  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

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

                    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 L 2 Replies Last reply
                    0
                    • S Samir Ibrahim 0

                      Thank you for your answer. Appreciated.

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

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

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