0

How do I stop my form from selecting a default/active control?

In my form load event I set various things up (like text on buttons, etc).

However, after it shows, one of my buttons becomes the accept button and I've no idea how to get rid of it. If I randomly remove some bits of code that set properties it shifts to the next button, etc.

It isn't actually becoming the Form's Accept (though it has the same thicker highlight) as I'm not setting that, but it also doesn't seem to be the tab order change because there is no dotted line inside the box, that appears when I tab between fields.

Unless every form automatically sets the tab order item 1 to be automatically set? in which case I've tried changing tab order and it doesn't. So the only thing I can think of is setting properties makes a field the current active? Any ideas how to stop this?

thanks.

Neil Walker
  • 6,400
  • 14
  • 57
  • 86

1 Answers1

0

Check How to set which control has focus on Application start.

It's about TabIndex..

Also, "Note that the TabIndex of container controls (panels etc) take precedence over their children - even if the container's TabStop is false. View > Tab Order makes this clear."

Or manually decide when to call Select(), of course.

Community
  • 1
  • 1
Bogdan
  • 68
  • 1
  • 1
  • 6