StrataFrame Forum

getting the form name that called the BO

http://forum.strataframe.net/Topic30217.aspx

By Ross L. Rooker, Sr. - 8/3/2011

How do I get a reference to the form or process that called the BO from inside the BO? IE... 1 BO can be called from many forms. I want to insert logic in the BO that requires knowing where the BO was called from. Also, I do not want to have to pass a parameter to the BO for this. somethong like this.bo.parent....
By Ivan George Borges - 8/3/2011

Hi Ross.

Inside the BO, you will get it using Me.ParentForm
By Ross L. Rooker, Sr. - 8/3/2011

I need to get the name of the  Me.ParentForm and save it to a string. How would I get this value? The is no such property as Me.ParentForm.Name
By Ivan George Borges - 8/3/2011

That is strange, Ross. I get it here just fine.

Would you mind posting a sample of your code and tell us where you are coding it?
By Ross L. Rooker, Sr. - 8/3/2011

tblActivityLog.ActivityLog_Source = this.ParentForm;

 

Gets "cannot implicitly convert type 'MicroFour.StrataFrame.UI.Windows.Forms.BaseForm' to 'string'

By Ross L. Rooker, Sr. - 8/3/2011

Got it, here is what is needed:

tblActivityLog.ActivityLog_Source = this.ParentContainer.ToString();

 

 

 

By Ivan George Borges - 8/4/2011

Glad you got it working.

But are you sure that this:

tblActivityLog.ActivityLog_Source = this.ParentForm.Name;


wouldn't get you the desired results?