>If I want to refer to a method or property of an object's own structure, how can I do that without having to use its own name to drill down to it?
>
>i.e.
>
>
> private void mmDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
> {
> string CustNo = this.mmDataGridView1.GetCurrentRowPK();
>
> }
>
>
>You see that I am having to use "this.mmDataGridView1" within the method just to refer to method with the same object.
>
>In Foxpro we coud say "this.method_name()" or "this.property_name" to access a method or property within a control's own structure, but in C#, "this" means the entire parent class, not the current object who's method code is firing.
>
>This is hard to explain, so I hope the question has made sense.
Where is this code? In a Form?
In that case since the mmDataGridView1_CellContentClick() method belongs to the Form then 'this' refers to the form. In short 'this' always refers to the class in which it is contained (except in extension methods). I don't see how this (no pun intended) differs from VFP behaviour.
BTW the 'This.' isn't needed unless there can be ambiquity.
HTH,
Viv