[Mono-winforms-list] Re: Problems with Button........

mandrake ievazquez2002@yahoo.com.mx
Sun, 28 Nov 2004 20:35:57 -0600 (CST)


--0-1403034362-1101695757=:61417
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hi everybody,
 
I just started playing with System.Windows.Forms on Windows.....and I got the error when  I set Button's Text property. It works with .net 1.1
 
This is my code..
 
using System.Windows.Forms;
using System;
public class Form1:Form
{
    Button b;
    public Form1()
    {
        b = new Button();
        b.Text = "Accept";
        b.Click += new EventHandler(b_Click);
        this.Controls.Add(b);
    }
    private void b_Click(object sender,EventArgs e)
    {
        System.Console.WriteLine("clicked");    
    }  
    static void Main()
    {
          Application.Run(new Form1());
    }
} 

with mono 1.0.4 I got 

C:\usuarios\Development\mono>mono window2.exe
Unhandled Exception: System.ArgumentException: Invalid Parameter. A null referen
ce or invalid value was found.
in <0x00073> System.Drawing.GDIPlus:CheckStatus (System.Drawing.Status)
in <0x00182> System.Drawing.Font:FromHfont (intptr)
in <0x00015> System.Windows.Forms.Control:get_DefaultFont ()
in <0x001af> System.Windows.Forms.Control:.ctor ()
in <0x00010> System.Windows.Forms.ScrollableControl:.ctor ()
in <0x00012> System.Windows.Forms.ContainerControl:.ctor ()
in <0x00016> System.Windows.Forms.Form:.ctor ()
in <0x0000f> Form1:.ctor ()
in <0x0004c> (wrapper remoting-invoke-with-check) Form1:.ctor ()
in <0x0001b> Form1:Main ()
 
with mono 1.1.2  
Invalid Parameter. A null reference or invalid value

Thanks in advance



---------------------------------
Do You Yahoo!?
Yahoo! Net: La mejor conexión a internet y 2GB en tu buzón de Correo Yahoo! por $100 al mes.

--0-1403034362-1101695757=:61417
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

<DIV>Hi everybody,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I just&nbsp;started playing with&nbsp;System.Windows.Forms on&nbsp;Windows.....and I got&nbsp;the error when&nbsp; I set Button's Text property. It works with .net 1.1</DIV>
<DIV>&nbsp;</DIV>
<DIV>This is my code..</DIV>
<DIV>&nbsp;</DIV>
<DIV>using System.Windows.Forms;<BR>using System;<BR>public class Form1:Form<BR>{<BR>&nbsp;&nbsp;&nbsp; Button b;<BR>&nbsp;&nbsp;&nbsp; public Form1()<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b = new Button();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b.Text = "Accept";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b.Click += new EventHandler(b_Click);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.Controls.Add(b);</DIV>
<DIV>&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;&nbsp;&nbsp; private void b_Click(object sender,EventArgs e)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.Console.WriteLine("clicked");&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; }&nbsp; </DIV>
<DIV>&nbsp;&nbsp;&nbsp; static void Main()<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Application.Run(new Form1());<BR>&nbsp;&nbsp;&nbsp; }<BR>} <BR></DIV>
<DIV>with mono 1.0.4 I got </DIV>
<DIV><BR>C:\usuarios\Development\mono&gt;mono window2.exe</DIV>
<DIV>Unhandled Exception: System.ArgumentException: Invalid Parameter. A null referen<BR>ce or invalid value was found.<BR>in &lt;0x00073&gt; System.Drawing.GDIPlus:CheckStatus (System.Drawing.Status)<BR>in &lt;0x00182&gt; System.Drawing.Font:FromHfont (intptr)<BR>in &lt;0x00015&gt; System.Windows.Forms.Control:get_DefaultFont ()<BR>in &lt;0x001af&gt; System.Windows.Forms.Control:.ctor ()<BR>in &lt;0x00010&gt; System.Windows.Forms.ScrollableControl:.ctor ()<BR>in &lt;0x00012&gt; System.Windows.Forms.ContainerControl:.ctor ()<BR>in &lt;0x00016&gt; System.Windows.Forms.Form:.ctor ()<BR>in &lt;0x0000f&gt; Form1:.ctor ()<BR>in &lt;0x0004c&gt; (wrapper remoting-invoke-with-check) Form1:.ctor ()<BR>in &lt;0x0001b&gt; Form1:Main ()</DIV>
<DIV>&nbsp;</DIV>
<DIV>with mono 1.1.2&nbsp;&nbsp;<BR>Invalid Parameter. A null reference or invalid value<BR></DIV>
<DIV>Thanks in advance</DIV><p><br><hr size=1><b>Do You Yahoo!?</b><br>
<a href="http://net.yahoo.com.mx"><b>Yahoo! Net</b></a>: La mejor conexión a internet y 2GB en tu buzón de Correo Yahoo! por 
<a href="http://net.yahoo.com.mx/">$100 al mes</a>.<br>
--0-1403034362-1101695757=:61417--