locked
Not able to hide panel(having user control) at runtime RRS feed

  • Question

  • Hi,

    I want to hide panel in winform at runtime on a button click. Pl tell me, is there any property or attribute which is not allowing me to set this Visible property to False.

     


    Regards, http://shwetamannjain.blogspot.com/
    Wednesday, December 22, 2010 7:12 AM

Answers

  • My issue is resolved. Some other component was making panel as visible
    Regards, http://shwetamannjain.blogspot.com/
    Wednesday, December 29, 2010 7:56 AM

All replies

  • Have you added your control(panel) in some control container?

    Please do the following:

    1. In your code. look for a constructor of your 'WinForm'.

    2. After 'InitializeComponent()' add line=> Controls.Add(yourPanel);

     

    Now, you should be able to hide it.


    Santosh.
    Wednesday, December 22, 2010 7:22 AM
  • I assume, the panel (panel1) which you want to hide is on a usercontrol (userControl1), and an instance of this usercontrol is on a windows form (winform1). And your requirement is to make the panel hide on click of a button which is on that windows form (winform1).

    Just make sure that the access modifier for panel1 is Public or Internal. Then the following line of code will flip the visiblity of that panel.

    userControl11.panel1.Visible = ! userControl11.panel1.Visible;

    Tell me if this is what you was looking for?

    Regards,
    Anuj Chauhan
    0091 9313499294
    anuj.mca@gmail.com

     


    Anuj
    • Proposed as answer by Mio_Miao Wednesday, December 29, 2010 3:24 AM
    Wednesday, December 22, 2010 7:38 AM
  • Yes Anuj, your understanding is correct.

    Panel is just flicking, but it is not getting hidden.


    Regards, http://shwetamannjain.blogspot.com/
    Wednesday, December 22, 2010 8:08 AM
  • Because I marked userControl11.panel1.Visible = ! userControl11.panel1.Visible;

    If you only require to hide it simply mark userControl11.panel1.Visible = false;

    Regards,
    Anuj Chauhan
    0091 9313499294
    anuj.mca@gmail.com

    Kindly mark my reply as answer, if it helped you :-)


    Anuj
    • Proposed as answer by Mio_Miao Wednesday, December 29, 2010 3:24 AM
    Wednesday, December 22, 2010 8:36 AM
  • Same thing I did, but still panel is not hidden
    Regards, http://shwetamannjain.blogspot.com/
    Wednesday, December 22, 2010 8:41 AM
  • hmmm strange, can you post or send your code ? I guess, its value is getting change at some other place in your code, which you are nto aware.

    Still, please send the code to better analyse it.

    Regards,
    Anuj Chauhan
    0091 9313499294
    anuj.mca@gmail.com

     


    Anuj
    Wednesday, December 22, 2010 8:56 AM
  • Can you do a "Find All Reference" on your panel to check all places where it is getting modified!?
    Happy to Help :)
    • Proposed as answer by Mio_Miao Wednesday, December 29, 2010 3:24 AM
    Wednesday, December 22, 2010 9:11 AM
  • Actually it is not possible to put code here
    Regards, http://shwetamannjain.blogspot.com/
    Wednesday, December 22, 2010 9:28 AM
  • "Find All Reference" I tried.
    Regards, http://shwetamannjain.blogspot.com/
    Wednesday, December 22, 2010 9:29 AM
  • So you are very sure that once you set Visible = false, there is nothing about the panel that gets modified?!?

    Happy to Help :)
    • Proposed as answer by Mio_Miao Wednesday, December 29, 2010 3:25 AM
    • Unproposed as answer by Mio_Miao Wednesday, December 29, 2010 8:14 AM
    Wednesday, December 22, 2010 9:41 AM
  • Hi Shweta Jain,

    Thank you for posting in the MSDN Forum.

     

    Does it work? If it worked, please mark the useful reply as answer. If it didn't work, check your code is ok, maybe there are some changes in it which are you didn't notice.

     

    Thank you for your understanding and support.

    I look forward to hearing from you.

     

    Best Regards,

    Mio

     

     


    Mio Miao[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, December 29, 2010 3:21 AM
  • My issue is resolved. Some other component was making panel as visible
    Regards, http://shwetamannjain.blogspot.com/
    Wednesday, December 29, 2010 7:56 AM
  • Good that you resolved the issue :)

    Plz mark the posts that helped :)


    Happy to Help :)
    My Blog
    Wednesday, December 29, 2010 8:00 AM