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.
The following sub sets the tab index of the controls
Private Sub SetTabSetting()
Dim i As Integer
Dim Ctr As Control
If UBound(TSetting) > 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
TSetting
is a TYPE Array defined in a Global Module.
Private Sub Form_Load()
GetRATabSetting
SetRATabSetting
End Sub
GetRATabSetting
is extracting the values from the database and populating into the TYPE arrray.
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.
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 ?