The other answers are not enough. You should trigger the check of the content somehow. The only way to do it is handling the event
myTextBox.TextChanged += delegate(object sender, EventArgs e) {
TextBox textBox = (TextBox)sender;
textBox.Enabled = string.IsNullOrEmpty(textBox.Text);
};
Now, let me tell you:
this is a trap. As soon as you delete the text, your text box cannot be edited anymore. Are you not afraid :-)?
I'm not sure you want to trigger this stuff in this way, at least I gave you the idea. After all, you can re-enable the text box using some other control with
textBox.Enabled = true
. I hope (as much as I can see from your Question), some updates are coming from the database; in this case getting non-empty data can re-enable the text box as you need.
—SA