开发者

VB6 resetting Tab Index Values - What to do about it?

I'm finding that as I change the TabIndex property for several controls on my forms, the VB6 is resetting them to different (not necessarily the old) values as soon as my back is turned. This is becoming rather annoying.

Does anyone know how to prevent this, or if it can't be stopped, what 开发者_如何学Cmethod is used to choose the values (so I can work with it rather than against it)?


Edited: To include MarkJ's comment

Are you editing them in the correct order? VB6 automatically changes the TabIndex for some controls if you try to set multiple controls to the same index.

So the best way to do it is usually to start with the control that you want to be the last one and set that to 0 or 1 (I can't remember which is the lowest in VB6) and then continue through every other control in reverse order.


Another option for dealing with TabOrder in VB6 is to use the MZTools Add-In. It's free and in addition to a nice tool for automagically organizing your controls' TabOrder, it has many other very useful utilities.


Here is a detailed written description (source) of the procedure mentioned in the other answer:

To set the tab order (tabindex) of your controls:

  1. Select the last control you want to receive the focus.
  2. GoTo Properties window and highlight tabindex.
  3. Type zero (0)
  4. Then click on the control you want to receive the focus before the control you were just on.
  5. Type zero (0)
  6. Keep going in reverse order (click control, type zero...)

Each time you set a controls tabindex to 0 if there is a control that has a k of 0 it will be incremented by 1 and if there is a control that has that tabindex it will then also be incremented by 1 (and so on and so on).

What you will find out when you are at the first control that you want to receive the focus is its tabindex will be 0 and the next control you want to receive focus will be +1 of that and so on and so on.

(Written by "vb5prgrmr" 25 Jul 02 15:20).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜