Command Button not displaying on form after a reload

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kabyr
    New Member
    • Nov 2007
    • 29

    Command Button not displaying on form after a reload

    I have a form with a form in my application.

    When the form is reloaded, a particular command button refuses to display even when there was no command to hide it. It only shows a blank shape where the button is supposed to be.

    Has anybody experienced this in the past.

    Kindly help me out with this as it does the same on clients' machines after compillation and deployment.
    Attached Files
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    I think we need you to provide us with some more background info. For instance...
    • What version of VB are you using?
    • What exactly do you mean by "reloading" the form?
    • What does a "form with a form" mean?

    Comment

    • Kabyr
      New Member
      • Nov 2007
      • 29

      #3
      Thank you Killer42
      Im using VB6
      by reloading, i mean unloading the form and then loading the form again to clear the data entered bythe user,thereby making the form blank and ready for data entry again

      unload me
      me.show

      "form with a form": this is a typo error. please pardon me for that, i meant "form with a command button".

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Hm...

        Not sure exactly what the problem is, but I must say it sounds like a bad idea to unload a form and then show it again, from within the form. At a guess, this could be causing VB some confusion. The unload command is supposed to entirely remove the form (including all code) from memory. Not sure how things work if you're still "in" the form executing code afterward. You're effectively telling VB "erase this code which I'm executing". Ugh.

        As a general rule, I'd advise against using the statement Unload Me unless it's the last one executed by "Me".

        Best I can think of right now is to either:
        • do this process from outside the form, or
        • create a sub that clears all the data, and call that instead of reloading the form.

        Oh, one more thing you might try first, since it's quicker and easier. Try fiddling with the form's ClipControls and AutoRedraw properties (just in the editor I mean, not your code), to see whether they make a difference. But make sure you make a note of what they are beforehand, so you can put them back afterward.

        Comment

        • Kabyr
          New Member
          • Nov 2007
          • 29

          #5
          Hi Killer42
          I had tried clipcontrols and AutoRedraw earlier. I think the issue is related to the fact that the button's style was set to graphics. I needed to set a back color for the button to let user identify it easily (these are old people with very little knowledge of the computer).

          Now, I changed style to default and it works fine.
          I still need to find a way to change the back color of that button without losing it on the form.

          For the unload and reload thing.

          Because the amount of items to be cleared are so much and there are so many other routines to be called after each data submission, it became difficult to just clear the form without unloading (the process is an online real time process which involves so many symultaneous complex database activities). And since the time difference is just in nanoseconds on a 486, I thought it will make no difference on a pentium or higher.
          However, the form.show is called from an external procedure not within the form.

          Thanks once again.

          Comment

          • BigPapaN0z
            New Member
            • Dec 2011
            • 24

            #6
            This might sound kind of silly, but perhaps adding
            Code:
            in Form_Load:
            DoEvents
            Me.Show
            This _might_ solve this visual glitch.

            Comment

            • Kabyr
              New Member
              • Nov 2007
              • 29

              #7
              Thanks BigPapa,
              The above code did not even solve the problem.

              I think there is an issue with the graphics style of the command button. It works well if set to standard. Issue arises when style is set to graphics.

              Comment

              • BigPapaN0z
                New Member
                • Dec 2011
                • 24

                #8
                While this isn't a fix, but rather a workaround, you might try keeping it a standard style and setting it to graphical via code after the form is loaded. Unfortunately, I have been unable to recreate the issue on my system and have never heard of this issue.

                Please keep us updated on this, we're always here to help!

                PS - Have you also updated VB6 with the latest service pack?

                Comment

                • Killer42
                  Recognized Expert Expert
                  • Oct 2006
                  • 8429

                  #9
                  Yes, I'm afraid I'm pretty much out of ideas. It's really tough to investigate something like this without being able to reproduce it.

                  All I can think of is experimentation with things like the button's .Refresh method, switching between standard & graphic modes, switching visibility on and off, and anything else you can come up with. Including switching style after the form's loaded, as BigPapaN0z suggested.

                  Comment

                  • Killer42
                    Recognized Expert Expert
                    • Oct 2006
                    • 8429

                    #10
                    P.S. One more thing I was wondering about. Is there anything else which is in front of the button, but not currently visible?

                    In any case, another "just in case" option you might try is using Format | Order | Bring to Front to bring this button to the front of the Z-order, just in case something is obscuring it.

                    Comment

                    • Kabyr
                      New Member
                      • Nov 2007
                      • 29

                      #11
                      Thank you guys for your help tips.
                      The style property is actually read only at run time so that is not an option.

                      The button has nothing in front of it but it is inside a frame as other controls. The other controls do not have any issues and I see no reason so far why this is happening,perha ps because it is the most active button and one that closes the form, because all other buttons are set as graphical also.
                      For now, I have decided to leave it as default so I can just meet my dead line. I shall keep working around until I find a solution. Once I do, you'll know about it.

                      Thank you all once agai. This family is a good one.

                      Comment

                      • Killer42
                        Recognized Expert Expert
                        • Oct 2006
                        • 8429

                        #12
                        Sorry we couldn't help you solve that one.

                        And yes, please let us know if you do find a solution, so it'll be here if anyone else needs it.

                        P.S. If it's in a frame, the .ClipControls property of the frame applies to it, not the form. No idea whether this will help.
                        Last edited by Killer42; Dec 28 '11, 02:07 PM. Reason: Added the postscript.

                        Comment

                        Working...