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. Other Discussions
  3. The Weird and The Wonderful
  4. Visual Basic 6: Public versus Private Function

Visual Basic 6: Public versus Private Function

Scheduled Pinned Locked Moved The Weird and The Wonderful
debuggingquestion
15 Posts 10 Posters 7 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.
  • N Offline
    N Offline
    Nilesh Hapse
    wrote on last edited by
    #1

    Well I don't know if anyone has seen this horror in Visual Basic 6.0 code. One of my colleague was doing his assignment. Now say there are three functions Function1, Function2, Function3. Function1 is calling Function2. But instead of going to Function2 it goes to Function3 :doh: . Now I've seen this my own eyes :confused: . We did try keeping a breakpoint at the call of Function2 from Function1. When this breakpoint is hit and I tried debugging it through F8 key. And I could not believe my eyes. It was going into Function3. Well after some trial and errors, I changed the function definition of Function3 from Public to Private and guess what??? It worked:laugh:. Now the code works fine. Any idea why this was happening? Has anybody seen this before?

    M P N T P 7 Replies Last reply
    0
    • N Nilesh Hapse

      Well I don't know if anyone has seen this horror in Visual Basic 6.0 code. One of my colleague was doing his assignment. Now say there are three functions Function1, Function2, Function3. Function1 is calling Function2. But instead of going to Function2 it goes to Function3 :doh: . Now I've seen this my own eyes :confused: . We did try keeping a breakpoint at the call of Function2 from Function1. When this breakpoint is hit and I tried debugging it through F8 key. And I could not believe my eyes. It was going into Function3. Well after some trial and errors, I changed the function definition of Function3 from Public to Private and guess what??? It worked:laugh:. Now the code works fine. Any idea why this was happening? Has anybody seen this before?

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      Surprisingly, compilers have bugs too. Have you installed Service Pack 6?

      Stability. What an interesting concept. -- Chris Maunder

      N V 2 Replies Last reply
      0
      • M Mike Dimmick

        Surprisingly, compilers have bugs too. Have you installed Service Pack 6?

        Stability. What an interesting concept. -- Chris Maunder

        N Offline
        N Offline
        Nilesh Hapse
        wrote on last edited by
        #3

        Yes! I have isntalled SP6...

        1 Reply Last reply
        0
        • N Nilesh Hapse

          Well I don't know if anyone has seen this horror in Visual Basic 6.0 code. One of my colleague was doing his assignment. Now say there are three functions Function1, Function2, Function3. Function1 is calling Function2. But instead of going to Function2 it goes to Function3 :doh: . Now I've seen this my own eyes :confused: . We did try keeping a breakpoint at the call of Function2 from Function1. When this breakpoint is hit and I tried debugging it through F8 key. And I could not believe my eyes. It was going into Function3. Well after some trial and errors, I changed the function definition of Function3 from Public to Private and guess what??? It worked:laugh:. Now the code works fine. Any idea why this was happening? Has anybody seen this before?

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

          I think that the coding horror here is that you are still using VB6.

          Deja View - the feeling that you've seen this post before.

          N 1 Reply Last reply
          0
          • N Nilesh Hapse

            Well I don't know if anyone has seen this horror in Visual Basic 6.0 code. One of my colleague was doing his assignment. Now say there are three functions Function1, Function2, Function3. Function1 is calling Function2. But instead of going to Function2 it goes to Function3 :doh: . Now I've seen this my own eyes :confused: . We did try keeping a breakpoint at the call of Function2 from Function1. When this breakpoint is hit and I tried debugging it through F8 key. And I could not believe my eyes. It was going into Function3. Well after some trial and errors, I changed the function definition of Function3 from Public to Private and guess what??? It worked:laugh:. Now the code works fine. Any idea why this was happening? Has anybody seen this before?

            N Offline
            N Offline
            NormDroid
            wrote on last edited by
            #5

            Solution: Don't use VB.

            Roger Irrelevant "he's completely hatstand"

            N 1 Reply Last reply
            0
            • P Pete OHanlon

              I think that the coding horror here is that you are still using VB6.

              Deja View - the feeling that you've seen this post before.

              N Offline
              N Offline
              Nilesh Hapse
              wrote on last edited by
              #6

              ;P;PIf you read my message carefully it's not me who is using VB. It's my colleague.

              P 1 Reply Last reply
              0
              • N NormDroid

                Solution: Don't use VB.

                Roger Irrelevant "he's completely hatstand"

                N Offline
                N Offline
                Nilesh Hapse
                wrote on last edited by
                #7

                I'm not! I'm using VB.NET and C#

                1 Reply Last reply
                0
                • N Nilesh Hapse

                  ;P;PIf you read my message carefully it's not me who is using VB. It's my colleague.

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

                  Nilesh Hapse wrote:

                  If you read my message carefully it's not me who is using VB. It's my colleague.

                  That's what they all say. "Officer, I wasn't coding in VB6. It was my, errrm, friend."

                  Deja View - the feeling that you've seen this post before.

                  V 1 Reply Last reply
                  0
                  • N Nilesh Hapse

                    Well I don't know if anyone has seen this horror in Visual Basic 6.0 code. One of my colleague was doing his assignment. Now say there are three functions Function1, Function2, Function3. Function1 is calling Function2. But instead of going to Function2 it goes to Function3 :doh: . Now I've seen this my own eyes :confused: . We did try keeping a breakpoint at the call of Function2 from Function1. When this breakpoint is hit and I tried debugging it through F8 key. And I could not believe my eyes. It was going into Function3. Well after some trial and errors, I changed the function definition of Function3 from Public to Private and guess what??? It worked:laugh:. Now the code works fine. Any idea why this was happening? Has anybody seen this before?

                    T Offline
                    T Offline
                    trelliot
                    wrote on last edited by
                    #9

                    There may be a question of scope - your colleague may have inadvertently named Function2 with a global so that if you had: Function1() Function2() Function3() and did not have debugging libraries installed, the code for Function2 (the wrong Function2 in this case) would execute and the debugger would step into Function3. The sequence would be: begin Function1 execute code (possibly under debugger) end Function1 begin and execute WrongFunction2 (debugger can't enter the code so it executes WrongFunction2) begin Function3 execute code end function

                    1 Reply Last reply
                    0
                    • N Nilesh Hapse

                      Well I don't know if anyone has seen this horror in Visual Basic 6.0 code. One of my colleague was doing his assignment. Now say there are three functions Function1, Function2, Function3. Function1 is calling Function2. But instead of going to Function2 it goes to Function3 :doh: . Now I've seen this my own eyes :confused: . We did try keeping a breakpoint at the call of Function2 from Function1. When this breakpoint is hit and I tried debugging it through F8 key. And I could not believe my eyes. It was going into Function3. Well after some trial and errors, I changed the function definition of Function3 from Public to Private and guess what??? It worked:laugh:. Now the code works fine. Any idea why this was happening? Has anybody seen this before?

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

                      Can you provide some code that exhibits the behaviour?

                      1 Reply Last reply
                      0
                      • N Nilesh Hapse

                        Well I don't know if anyone has seen this horror in Visual Basic 6.0 code. One of my colleague was doing his assignment. Now say there are three functions Function1, Function2, Function3. Function1 is calling Function2. But instead of going to Function2 it goes to Function3 :doh: . Now I've seen this my own eyes :confused: . We did try keeping a breakpoint at the call of Function2 from Function1. When this breakpoint is hit and I tried debugging it through F8 key. And I could not believe my eyes. It was going into Function3. Well after some trial and errors, I changed the function definition of Function3 from Public to Private and guess what??? It worked:laugh:. Now the code works fine. Any idea why this was happening? Has anybody seen this before?

                        C Offline
                        C Offline
                        Chris Maunder
                        wrote on last edited by
                        #11

                        Please post the code so we can explain why it's user error and not a problem with the compiler. I have a feeling there's a true Coding Horror lying in wait for us.

                        cheers, Chris Maunder

                        CodeProject.com : C++ MVP

                        1 Reply Last reply
                        0
                        • M Mike Dimmick

                          Surprisingly, compilers have bugs too. Have you installed Service Pack 6?

                          Stability. What an interesting concept. -- Chris Maunder

                          V Offline
                          V Offline
                          Vasudevan Deepak Kumar
                          wrote on last edited by
                          #12

                          Mike Dimmick wrote:

                          compilers have bugs too

                          And to fuel it, it is Visual Basic 6. :mad: :)

                          Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                          1 Reply Last reply
                          0
                          • P Pete OHanlon

                            Nilesh Hapse wrote:

                            If you read my message carefully it's not me who is using VB. It's my colleague.

                            That's what they all say. "Officer, I wasn't coding in VB6. It was my, errrm, friend."

                            Deja View - the feeling that you've seen this post before.

                            V Offline
                            V Offline
                            Vasudevan Deepak Kumar
                            wrote on last edited by
                            #13

                            Pete O`Hanlon wrote:

                            That's what they all say.

                            PosterDeclaration objPosterDeclaration = (Friend_Told_Me_Or_Friend_Used_It) I_Used_It(); :-D

                            Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                            D 1 Reply Last reply
                            0
                            • V Vasudevan Deepak Kumar

                              Pete O`Hanlon wrote:

                              That's what they all say.

                              PosterDeclaration objPosterDeclaration = (Friend_Told_Me_Or_Friend_Used_It) I_Used_It(); :-D

                              Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                              D Offline
                              D Offline
                              dojohansen
                              wrote on last edited by
                              #14

                              I'd change the variable name to "lie", but otherwise the code is fine...

                              1 Reply Last reply
                              0
                              • N Nilesh Hapse

                                Well I don't know if anyone has seen this horror in Visual Basic 6.0 code. One of my colleague was doing his assignment. Now say there are three functions Function1, Function2, Function3. Function1 is calling Function2. But instead of going to Function2 it goes to Function3 :doh: . Now I've seen this my own eyes :confused: . We did try keeping a breakpoint at the call of Function2 from Function1. When this breakpoint is hit and I tried debugging it through F8 key. And I could not believe my eyes. It was going into Function3. Well after some trial and errors, I changed the function definition of Function3 from Public to Private and guess what??? It worked:laugh:. Now the code works fine. Any idea why this was happening? Has anybody seen this before?

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

                                Try

                                #define public private

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