Click here to Skip to main content
15,886,110 members

How to create a method to access Parent Form Properties

Revision 2
Hello Friends,

I was just working with VB today yet it isn't my field of interest but I was trying to create a custom theme for windows form application, I started by creating a WPF based custom control (Seriously I haven't worked with it ever), I created a TitleBar with it, with a Title text on top and three buttons on the right hand corner as usual, now I was writing the event methods, and I want a way such that when I click one of the buttons in this custom control, I can access it's parent form properties or method. For Example, If I click on the leftmost button, The form closes, and if I click the first button, the form minimizes irrespective of the form name, so that whichever form uses it, can use it's feautres. I was trying to figure out how can it be done.

Please help me figure out this.

I know this is not the correct syntax but it is what I am trying to implement.

VB
Public Sub btnClose_MouseUp(sender As System.Object, e As System.EventArgs) Handles btnClose.MouseUp

Parent.CloseForm()

End Sub


This is not at all correct but I write it just like this because I wanted to explain the question as it may not be clear by my words.

Please help me regarding this....

Thank you.
Posted 16-Sep-12 7:58am by Er. Tushar Srivastava.
Tags: