Link to home
Start Free TrialLog in
Avatar of shambhu_421
shambhu_421

asked on

one formview to another form view..

Hi friends,
In my application , i need to call one formview from another formview.
could you kindly help me.
thnaks!
sham.
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

are the formviews from the same document?

If you want the second view to pop up and float over the first view, then your best bet is to use a modal dialogbox for the scond view.

If you want the second view to replace the first view, you need to use code that will replace the current view.  This is a very common need, even if it is a bit tricky.  It is decribed in:

Q149257 - How to Replace a View in a Splitter Window
http://support.microsoft.com/support/kb/articles/Q149/2/57.ASP

and

Q102829 - How to Replace a View in a CMDIChildWnd Window
http://support.microsoft.com/support/kb/articles/Q102/8/29.asp 

-- Dan
Avatar of shambhu_421
shambhu_421

ASKER

Hi sedgwick,
yes,forms are in same document.
thanks,
sham.
so iterate your document using POSITION:

//u r in the scope of one of the forms view:
CMyDocument()* pDoc = GetDocument();
POSITION pos = pDoc->GetFirstViewPosition();
while(pos)
{
CMyFormView* pView = (CMyFormView*)pDoc->GetNextView(pos);
if(pView == this)
    continue; //the same form view

/*since u can have more than 2 viewes in the document so u probably have an identification in order to determine which form view u want to work with.*/

}

good luck
U can use the IsKindof() function to determine what view you are iterating through. This function violates polymorphism but is handy at times like this.
hi shambhu_421,
Do you have any additional questions?  Do any comments need clarification?

-- Dan
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Comment from DanRollins accepted as answer.

Thank you
Computer101
Community Support Moderator