Click here to Skip to main content
15,898,134 members

Comments by Adnan Maruf (Top 6 by date)

Adnan Maruf 6-Nov-19 12:30pm View    
Thanks for your answer! but this a C# Winform application and not a webpage :)
Adnan Maruf 8-Jan-18 16:02pm View    
@OriginalGriff Thank you Sir for your kind and amazing time :)! I did bash my head hundred times the entire day :D! to figure it out I need to set the AutoToolBoxPopulate setting of my VS2008 to ture in order to have the UserControl on the toolbox. I did not exactly implemented your method this time but I found something pretty similar and guess what it's working now :D !! and that's because your word encourage me to search about my lackings and improve it. Now I know exactly what I need to do in order to deal with this type of situation. I really appreciate your help sir, you are amazing!! #keepCalm&deepSearch...
by the way I'm from a small country called Bangladesh[if you are wondering :)]
Adnan Maruf 8-Jan-18 6:15am View    
And I did watch the Vs debugger and it's kind of a confusing now...!
Adnan Maruf 8-Jan-18 6:14am View    
Sir thank you again, Last night it was already late [almost 3am] so I stop there and starting today it again. I understand the designer and it's toolbox that every elements on it has there own property and these values can be changed visually from the property pane and also the events which can be access through a single mouse click and it has loads of events handlers like loads,mouse up, visualChanged,etc. and can be add to code by double clicking on it. So I add the form1 VisualChanged event handler then add those code-->

 private void Form1_VisibleChanged(object sender, EventArgs e)
        {
            UserControl1 uc = sender as UserControl1;
            if (uc != null)
            {
                button2.Enabled = uc.IsVisible;
            }

        }


but no luck it didn't work. So then I thought it may be because of the UserControl1 is added to the form1 panel when I'm clicking the form1_button1. so it should be that panel VisualChanged event handler, so I add that and put the same code..>

private void mainPanel_VisibleChanged(object sender, EventArgs e)//mainPanel==form1_panel1
        {
            UserControl1 uc = sender as UserControl1;
            if (uc != null)
            {
                button2.Enabled = uc.IsVisible;
            }
            
        }



then again it still won't work, form1_button2 is not enabling as it should no matter how many time I change the UserControl1_panel2 visible property. I mean I'm a slow learner I know but it should work at some point right? Now it is the 4th day and I'm still stuck with the same problem.
Adnan Maruf 7-Jan-18 13:32pm View    
@OriginalGriff sir sorry for asking your time again. I vaguely understand your this statement "In the designer, add the handler to the UserControl1 instance event" here. Do you mean to add these code-->>

/// <summary>
/// Event to indicate VisibiltyChanged
/// </summary>
public event EventHandler VisibilityChanged;
/// <summary>
/// Called to signal to subscribers that VisibiltyChanged
/// </summary>
/// <param name="e"></param>
protected virtual void OnVisibilityChanged(EventArgs e)
    {
    EventHandler eh = VisibilityChanged;
    if (eh != null)
        {
        eh(this, e);
        }
    }


to the UserControl1.Designer.cs ??

if so then I already tried that and it giving me a bunch of error...!

and if not then can please show me exactly, what to put where? and what to do?! Please do consider me as a novices here cause my knowledge about coding and C# is so thin. Hope you will understand what I am trying to say. Thanks again :)