By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,452 Members | 1,571 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,452 IT Pros & Developers. It's quick & easy.

Textbox question

P: n/a
Is there a easy way to stop a textbox receiving focus ? if so how ?
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi CobraStrikes,

You could use a Label, set BackgroundColor to the same as a TextBox and use a Fixed3D border. This is probably the simplest.

You could also handle the Enter event of the TextBox and pass the focus on to the next control in the tab order

private void textBox1_Enter(object sender, System.EventArgs e)
{
Control c = textBox1;

// find the next control in the tab order until
// we encounter one that can be selected
do
c = this.GetNextControl(c, true);
while(!c.CanSelect && c != textBox1);

c.Focus();
}

On Fri, 30 Sep 2005 13:34:08 +0200, <Co**********@al.com> wrote:
Is there a easy way to stop a textbox receiving focus ? if so how ?


--
Happy coding!
Morten Wennevik [C# MVP]
Nov 17 '05 #2

P: n/a
WinForms? If so, set the textbox TabStop property to false. However, user
can always click on the Text box to set the focus. Or, set Enabled property
to False.

<Co**********@al.com> wrote in message
news:Qo*****************@newsfe4-win.ntli.net...
Is there a easy way to stop a textbox receiving focus ? if so how ?

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.