[Mono-winforms-list] TextBox error
Alexander Reiter
r.alex at utanet.at
Fri Dec 23 13:36:58 EST 2005
hi,
i've tried your example and it works fine. maybe the problem in your case is that the textbox is large enough
to go over the right side border ... have you already tried to change the size or location of the box like this:
using System;
using System.Drawing;
using System.Windows.Forms;
public class Form1 : Form
{
TextBox textBox1 = new TextBox();
public Form1()
{
textBox1.Location = new Point(126, 28); <--
textBox1.Name = "textBox1";
textBox1.Size = new Size(112, 20);
textBox1.Text = "";
Controls.Add(textBox1);
}
static void Main()
{
Application.Run(new Form1());
}
}
/alex
Am Freitag, 23. Dezember 2005 16:14 schrieb NEMO777 (sent by Nabble.com):
>
> hi
>
> i'm trying to run this:
>
> using System;
> using System.Drawing;
> using System.Windows.Forms;
>
> public class Form1 : Form
> {
> TextBox textBox1 = new TextBox();
>
> public Form1()
> {
> textBox1.Location = new Point(176, 48);
> textBox1.Name = "textBox1";
> textBox1.Size = new Size(112, 20);
> textBox1.Text = "";
>
> Controls.Add(textBox1);
> }
>
> static void Main()
> {
> Application.Run(new Form1());
> }
> }
>
>
> "mcs /r:System.Windows.Forms /r:System.Drawing x.cs" runs clean, but when I try to run the exe i get this:
>
> Mono System.Windows.Forms Assembly [Revision: 54007; built: 2005/12/6 14:35:24]
> Keyboard: United States keyboard layout (phantom key version)
> Gtk colorscheme read
>
> Unhandled Exception: System.ArgumentException: '0' is not a valid value for 'Value'. 'Value' should be between 'Minimum' and 'Maximum'
> in <0x000a7> System.Windows.Forms.ScrollBar:SetValue (Int32 value)
> in <0x00146> System.Windows.Forms.ScrollBar:UpdatePos (Int32 newPos, Boolean update_thumbpos)
> in <0x00057> System.Windows.Forms.ScrollBar:set_Maximum (Int32 value)
> in (wrapper remoting-invoke-with-check) System.Windows.Forms.ScrollBar:set_Maximum (int)
> in <0x001f1> System.Windows.Forms.TextBoxBase:CalculateScrollBars ()
> in <0x0000a> System.Windows.Forms.TextBoxBase:document_HeightChanged (System.Object sender, System.EventArgs e)
> in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
> in <0x00350> System.Windows.Forms.Document:RecalculateDocument (System.Drawing.Graphics g, Int32 start, Int32 end, Boolean optimize)
> in <0x00017> System.Windows.Forms.Document:RecalculateDocument (System.Drawing.Graphics g)
> in <0x00026> System.Windows.Forms.Document:owner_HandleCreated (System.Object sender, System.EventArgs e)
> in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
> in <0x00023> System.Windows.Forms.Control:OnHandleCreated (System.EventArgs e)
> in <0x0000d> System.Windows.Forms.TextBoxBase:OnHandleCreated (System.EventArgs e)
> in <0x0000d> System.Windows.Forms.TextBox:OnHandleCreated (System.EventArgs e)
> in <0x000e4> System.Windows.Forms.Control:CreateHandle ()
> in <0x0000a> System.Windows.Forms.TextBoxBase:CreateHandle ()
> in <0x00029> System.Windows.Forms.Control:CreateControl ()
> in <0x0007b> System.Windows.Forms.Control:OnVisibleChanged (System.EventArgs e)
> in <0x00182> System.Windows.Forms.Control:ChangeParent (System.Windows.Forms.Control new_parent)
> in (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:ChangeParent (System.Windows.Forms.Control)
> in <0x001a9> System.Windows.Forms.Control+ControlCollection:Add (System.Windows.Forms.Control value)
> in <0x000fd> Form1:.ctor ()
> in (wrapper remoting-invoke-with-check) Form1:.ctor ()
> in <0x00018> Form1:Main ()
>
> I use mono-1.1.12.1 and libgdiplus-1.1.11 and Gentoo Linux.
> i'm new here and can some one just tell mi why this happens, is it because i've got something wrong or is it a bug... or just MWF isn't working yet with TextBox's
>
> Bye
> --
> Sent from the Mono - WinForms forum at Nabble.com:
> http://www.nabble.com/TextBox-error-t797793.html#a2076284
>
More information about the Mono-winforms-list
mailing list