My textbox is set to read-only, but I need to disable the focus on a textbox. There's an error that a read-only textbox could not lost focus.

Is there any other way to get a white backcolor that has a particular width? I tried to do it with textbox and set the formborderstyle to none and it works just like the way I wanted to, but it looks kind of weird when there is a focus.

Recommended Answers

All 5 Replies

Is there any other control on the form, you can set its primal focus? If you can try to set the focus to the form:
this.Focus();

that doesn't focus to the form. :( yeah maybe I would just put the focus on a label.

omg. I tried to set label1.focus() and still the focus is on the textbox.

I just read that focus can't be set to a label because a label doesn't accept input. Only the controls that accept input can be focus.

I tried Select method and it works!

label1.Select()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.