Re: object reference not set to an instance of an object

Jonathan Pobst <[email protected]>
Newsgroups gmane.comp.gnome.winforms
Message-ID <[email protected]>
Most likely it is ActiveForm.Controls.

Check before this code with:

if (ActiveForm == null)
   Console.WriteLine ("activeform null");


Jonathan


On 10/29/2010 4:31 PM, luisrl wrote:
>
> I'm getting the next exception:
>
> object reference not set to an instance of an object
>
> In the next code:
>
> foreach (Control ctl in ActiveForm.Controls)
> {
>        if (ctl.GetType() == typeof(TextBox))
>     {
>        ctl.Text = string.Empty;
>     }
> }
>
> This is happening in Ubuntu 10.04 + Mono 2.8, in Windows Server 2008 + Mono
> 2.8 this is working fine.
>
> Since in Ubuntu it doesn't tell me line where it's happening, I'm not sure
> what's the problem.
>
> Any ideas?
>

_______________________________________________
Mono-winforms-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-winforms-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.