[Mono-winforms-list] Clearing Textbox Controls

Stifu stifu at free.fr
Fri Aug 13 18:34:26 EDT 2010


It is this bug: https://bugzilla.novell.com/show_bug.cgi?id=621475
I submitted a patch for it, but it hasn't been applied yet.

scruffyruffian wrote:
> Hi,
> I apologise if this has come up before, I used the search but found
> nothing particularly relevant. I have an application written in C# .NET
> 3.5 which I'm trying to get running with Mono so that people using Linux
> can mess with it too.
> I have a text box which starts off with text in it, then when the user
> clicks, it uses the click event to remove that default text - allowing the
> user to enter their own without having to delete the default text
> manually.
> However, running under Mono (2.6.7), when I click on the text box control
> it clears the text, but the next click or keyboard hit will cause the form
> to just close.
> I tried creating a new Solution in VS2008, stuck a text box on the form.
> The only property I changed was the "Text" on the TextBox control which I
> changed to "Hello".
> I then gave the TextBox control a "Click" event, and tried doing the
> following to try and clear the text box without causing the form to close
> unwontedly (not all at once - 3/4 were commented out at all times):
> textBox1.Text = "";
> textBox1.Text = string.Empty;
> textBox1.Clear();
> textBox1.Text = null;
> However, all of these cause the form to simply close after clearing the
> text from the box.
> Interestingly - if I add something like this:
> MessageBox.Show("Hi");
> After the line for clearing the text box then the form doesn't close after
> clicking. It brings up the message box and then gives you the cleared text
> box to enter into what you wish, and remains usable.
> Am I the only one who experiences this behaviour? I'm not a professional
> developer, I'm just messing with it myself in the hope of learning
> something - so could it be that some practice on my part is causing my
> issues?
> Note: No error log is generated, the form appears to close as if you were
> trying to close it normally. (I believe for example, that it would trigger
> the form_closing event).
> Very simple example solution for VS2008 attached here: 
> http://mono.1490590.n4.nabble.com/file/n2324792/TextBoxExample.tar.gz
> TextBoxExample.tar.gz 

View this message in context: http://mono.1490590.n4.nabble.com/Clearing-Textbox-Controls-tp2324792p2324834.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.

More information about the Mono-winforms-list mailing list