Forms inheritance with UIP 2.0

G

Guest

Hi,
We are using UIP 2.0 and we encountered a problem when trying to inherit
from a form that inherits from UIProcess.WindowsFormView. Our base form have
an onLoad event handler that call its controller:

private MyController myController
{
get
{
return (MyController)this.Controller;
}
}

private void Form1_Load(object sender, System.EventArgs e)
{
this.myController.DoSomething()
}

The problem is that the inherited from will not open in the designer as long
as we have this call to the controller in our load event.

Any ideas?

Thanks,
Gwenda
 
G

Guest

Hi Gwenda,

Try this:

private void Form1_Load(object sender, System.EventArgs e)
{
if (!DesignMode)
{
this.myController.DoSomething();
}
}

Hope that helps.

Regards,
Matt Garven
 
G

Guest

Thanks Matt, but that didn't work....It seems that only by commenting out all
the code that have a call to the controler...
 
G

Guest

Do you have more detail on what the error message is at the time? Any extra
detail you can post here will help to solve the problem.

You can try opening two copies of Visual Studio. With the first one, load
the solution that has the problem (don't open any of the files or the
designer at this point, and if they are open close them). With the second
one, go to the Tools Menu, find "Debug Processes" (Ctrl+Alt+P is the
shortcut). Find the other "devenv.exe" process (the one that has the solution
loaded) and attach to that. Then turn break-on-exception on (Ctrl+Alt+E) for
all CLR Exceptions.

Then open the form that you're having trouble designing. The other copy of
Visual Studio should catch the exception thrown and hopefully help you find
the problem.

Hope this helps.

Regards,
Matt Garven
 
J

Jeffrey Tan[MSFT]

Hi Gwenda,

I think Matt has provided you the way of debugging design-time inherited
form. Have you tried this debug way? Is your problem resolved? Please feel
free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Hi Jeffrey and Matt and thank you both for your help. I followed Matt
suggestion but I havn't been able to get further info about the problem. The
dubugger told me what I already knew. As I said in my initial post, the
problem occure each time the base form call its controller. when I open the
inharited form in the desigener I get - $exception {"Object reference not set
to an instance of an object." } System.NullReferenceException

This is why I think this is a problem in The way I implement forms
inharitace with the UIP.
Thanks,
Gwenda
 
J

Jeffrey Tan[MSFT]

Hi Gwenda,

Thanks very much for your feedback!!

For this issue, I suggest you debug into the "MyController" class code to
see which statement generates this NullReferenceException, and which
object's reference is NULL. Then we may refer to next step to find out why
this null reference object is not initilized before being used.

Anyway, I will wait for your further feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top