Question about controls on a form.

Question about controls on a form.

Anonymous
Not applicable
488 Views
7 Replies
Message 1 of 8

Question about controls on a form.

Anonymous
Not applicable
Hi, I can access the tabindex of the active control, test = frmCadre.ActiveControl.TabIndex But I need to access what's written in lets say tabindex(4). The idea is to fill a title box with what's in a form, only if I scroll through all controls, well it's all the controls! Thanks.
0 Likes
489 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
I am not sure what you are trying to do, would you give more info. why don't you use the control name? I wonder if you could get any where with that approach.
0 Likes
Message 3 of 8

Anonymous
Not applicable
Yves wrote: > But I need to access what's written in lets say tabindex(4). Nothing's written there because it's not a text property. It indicates the sequence in which control will receive the focus when the user presses the TAB key. -- There are 10 kinds of people. Those who understand binary and those who don't. http://code.acadx.com (Pull the pin to reply)
0 Likes
Message 4 of 8

Anonymous
Not applicable
This may be what you want to do.

Private Sub UserForm_Click()
Dim objControl As Control
Dim intTabIndex As Integer
For Each objControl In UserForm1.Controls
intTabIndex = objControl.TabIndex
If intTabIndex = 4 Then
'do stuff here
End If
Next objControl
End Sub

Regards - Nathan
0 Likes
Message 5 of 8

Anonymous
Not applicable
 
0 Likes
Message 6 of 8

Anonymous
Not applicable
How are the controls added to the form? Did you add them to the form yourself (manually), or are they created by code? If you created them yourself, I don't think you should need to use their TabIndex to access them. I don't want you to rewrite your whole program if it is almost working, but it seems "dangerous" to base your logic for filling the form on the order that the TAB key cycles through your controls. It seems like the part you are having trouble with is when you try to fill your form from the titleblock. Can you post your code for this part of the program? Also, I added a line to Nathan's code (below) to show the names and tabindexes of the controls. James > > > > Private Sub UserForm_Click() > > Dim objControl As Control > > Dim intTabIndex As Integer > > For Each objControl In UserForm1.Controls Debug.Print objControl.Name & " " & intTabIndex (new) > > intTabIndex = objControl.TabIndex > > If intTabIndex = 4 Then > > 'do stuff here > > End If > > Next objControl > > End Sub > >
0 Likes
Message 7 of 8

Anonymous
Not applicable
On the web side I can't see the body of this reply to my message. A question to Anne Brown, can it be reposted to the web side.

Regards - Nathan
0 Likes
Message 8 of 8

Anonymous
Not applicable
Here it is. -- Anne Brown Discussion Groups Administrator Autodesk, Inc. Subject: Re: Question about controls on a form. Date: Wed, 4 Feb 2004 09:56:39 -0500 From: "Yves" Newsgroups: autodesk.autocad.customization.vba Well I must be missing something here. When I go through all the controls on the form and stop (Debug) when tabindex and get the name of the control, it doesn't give my the correct name, it looks as if it is the first control I've put on the form when creating it, not the Tabindex property! "Nathan Taylor" a écrit dans le message de news:20856249.1075861024626.JavaMail.jive@jiveforum1.autodesk.com... > This may be what you want to do. Nathan Taylor wrote: > > On the web side I can't see the body of this reply to my message. A question to Anne Brown, can it be reposted to the web side. > > Regards - Nathan
0 Likes