|
-
Apr 13th, 2004, 10:45 AM
#1
Thread Starter
Hyperactive Member
textbox collection(resolved by alextyx)
I want to create a textbox collection by the textboxes on my form, after I add two, i still get the collection's item count is 0.
Here is my code:
VB Code:
Dim colText As TextBox.ControlCollection = New TextBox.ControlCollection(Me)
colText.Add(txtDBName)
colText.Add(txtFileName)
Last edited by Palmtree; Apr 14th, 2004 at 09:15 AM.
-
Apr 14th, 2004, 06:42 AM
#2
Fanatic Member
i think the value for argument of ControlCollection method is Forms.Control and not a Form.
VB Code:
ControlCollection(Me.TextBox1)
-
Apr 14th, 2004, 07:13 AM
#3
Thread Starter
Hyperactive Member
thanks for your reply.
but I do not get it. your "Textbox1" can be either txtDBName or txtFileName or what?
-
Apr 14th, 2004, 08:54 AM
#4
Hyperactive Member
Try this way:
Dim Txt As TextBox
Dim myCollection As New Collection
myCollection.Add(Me.TextBox1)
'Now Items.count=1
Txt = CType(myCollection.Item(1), TextBox)
'Now, for example, Txt.Text=TextBox1.text
Good job!
Live long and prosper (Mr. Spock)
-
Apr 14th, 2004, 09:14 AM
#5
Thread Starter
Hyperactive Member
YES, fantastic job!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|