none
button invisible at runtime in vb.net RRS feed

  • Question

  • I made a form containing several controls with code, and there was no problem. After a month I opened the same project, and on that form, I added a button which was visible during design time. On running, all of the forms' controls where there except for the new button, which was not visible. Why is the new button not visible?

    Sunday, February 9, 2020 1:14 PM

All replies

  • There could be countless reasons.

    Try right clicking on the project in solution explorer and select "rebuild" then F5 to start the app, does the new button show? If not open the project folder in windows explorer and delete the Bin and Obj folder, rebuild, start. If neither fixes the problem show your code and make sure the Visible property of the new button is set to True.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Sunday, February 9, 2020 1:43 PM
    Moderator
  • Hi abdelwahab.whb,

    Thank you for posting here.

    Make sure the Button's visible property is true.

    You can try force the screen update by calling Application.DoEvents() and then check that the button is visible.

        button.Visible = True
        Application.DoEvents()

    Besides, if this is not helpful, please provide some related code here, and it will help us to make a test.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 10, 2020 3:24 AM
    Moderator
  • I'm afraid the invisible button is under another control.
    Please check if it is overwrapped with other controls.

    Ashidacchi -- http://hokusosha.com

    Tuesday, February 11, 2020 9:54 AM
  • Hi abdelwahab.whb,

    Did you solve your problem? If your question has been answered then please click the "Mark as Answer" Link at the bottom of the correct post(s), so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 26, 2020 2:08 AM
    Moderator
  • It can be that it is hidden behind another control. 

    But there is a View Window to see that. It is called "document outline"


    Success
    Cor

    Wednesday, February 26, 2020 6:13 PM
  • I suppose the invisible button is under/behind another control.
    Make it topmost (BringToFront):
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ' --- creating controls with code ---
        '   .....
        ' --- make the newly added button in Desigin view topmost
        Me.Added_Button.BringToFront()
    End Sub
    Regards,

    Ashidacchi -- http://hokusosha.com

    Wednesday, February 26, 2020 11:06 PM