PHAM Tuan Anh
-
2011-09-01
- status: open --> open-fixed
The following code (in file WinformViewManager.vs) throw exeption when user control cannot find its form:
UserControl uc = view as UserControl;
viewActivatedInCode = true;
uc.FindForm().Show(); // this is the bug when FindForm return null
uc.FindForm().Activate();
This situation is when i create a control user as a View and navigate to this view. I fixed this bug as following code :
// bug : fixed
//uc.FindForm().Show();
//uc.FindForm().Activate();
Form formOwner = uc.FindForm();
if (formOwner == null)
uc.Show();
else
{
uc.FindForm().Show();
uc.FindForm().Activate();
}
This correction can fixe the previous bug