So Simple...

  • Thread starter Thread starter joey.powell
  • Start date Start date
J

joey.powell

Does anyone know how to make the Leave event work for a regular
textbox? I have tried several times already...the event handlers are
there...it just doesn't fire when you tab off of the textbox and onto
another control. What gives?
 
Does anyone know how to make the Leave event work for a regular
textbox? I have tried several times already...the event handlers are
there...it just doesn't fire when you tab off of the textbox and onto
another control. What gives?

The following code works for me when tabbing of the two TextBoxes:

---8<---
using System;
using System.Drawing;
using System.Windows.Forms;

class App
{
static void Main()
{
Form form = new Form();
TextBox a = new TextBox();
a.Parent = form;
a.Location = new Point(10, 10);

TextBox b = new TextBox();
b.Parent = form;
b.Location = new Point(10, 40);

a.Leave += delegate
{
form.Text = "Left A";
};

b.Leave += delegate
{
form.Text = "Left B";
};

Application.Run(form);
}
}
--->8---

Is there something unusual or special about the structure of your form?

-- Barry
 
Back
Top