title: How Can I Assign TabIndex in runtime in VB6
body: <p>I am working in a VB6 maintenance application. It is a windows based application. My client wants to configure the controls tab index at runtime. I am saving the client setting to the access database. </p>
  
  <p>The following sub sets the tab index of the controls </p>
  
  <pre><code>Private Sub SetTabSetting()
  Dim i As Integer
  Dim Ctr As Control
  If UBound(TSetting) &gt; 0 Then
      For i = 0 To UBound(TSetting)
          For Each Ctr In Me.Controls
              Dim matched As Boolean: matched = False
  
              If Ctr.Name = TSetting(i).ControlName Then
                 Ctr.TabIndex = TSetting(i).TabIndexNum
                 Exit For
              End If
          Next
      Next
  End If
  End Sub
  </code></pre>
  
  <p><code>TSetting</code> is a TYPE Array defined in a Global Module.</p>
  
  <pre><code>Private Sub Form_Load()
    GetRATabSetting
    SetRATabSetting
  End Sub
  </code></pre>
  
  <p><code>GetRATabSetting</code> is extracting the values from the database and populating into the TYPE arrray.</p>
  
  <p>The code is getting executed quite fine. Even the values get extracted from the database  and set to the controls correctly. But the tab is following the index what is set in the designtime. </p>
  
  <p>Am I doing any mistake? Is it possible to set the tabindex of the controls at runtime ? Is there any other way to perform this ?</p>