[Mono-winforms-list] object reference not set to an instance of an object
Jonathan Pobst
monkey at jpobst.com
Fri Oct 29 17:39:40 EDT 2010
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?
>
More information about the Mono-winforms-list
mailing list