[Mono-winforms-list] Not sure if this is an event or code problem

Paul F. Johnson paul at all-the-johnsons.co.uk
Thu Mar 9 06:06:37 EST 2006


Hi,

The source for this question is at

http://www.smmp.salford.ac.uk/csharp/list7.cs

(it's about 8k in length so I'd rather not post it here).

I've got an event connected to a button which is set up in the Form
definition in the usual way

this.Connect.Click += new System.EventHandler(this.Connect_Click)

This is made active when either the username and password are entered or
an IP address and username and password are entered. The event will do
two things, though only does one currently and it's that which I'm not
sure about.

The event checks the contents of the IP boxes to ensure they're less
than 255 (the boxes only accept numbers, so letters aren't a problem).
The problem is that if you enter a value > 255, the code generates a
message box and then clears the box using ((TextBox)IP[i]).Clear(); the
button is then disabled.

The clear does as it should, but then won't allow a new number to be
entered. Have I used the correct method or is this a mono problem?

TTFN

Paul

P.S. Before anyone says, it's not very pleasant to look at when it's
compiled (and executed) and under Linux, the number box event handler
isn't doing as it should and rejecting non-numbers
-- 
"Logic, my dear Zoe, is merely the ability to be wrong with authority" -
Dr Who



More information about the Mono-winforms-list mailing list