|
-
May 14th, 2004, 02:31 PM
#1
Thread Starter
Lively Member
Control Ojects
Hi All:
I need some serious help because I am lost!!!!!
I have a collection. I add a frame to that collectio and attached few objects to the collection. (i.e combobox and textboxes). My goal is to add and remove collection and all the object inside the collection,but it is not workin.
I am able to add the object to my collection at run time the first time my form is loaded,however when I try to add the object the second time, I get an error. The error is:"There is already a control with the name 'Frame1'. I get this error even though I remove the oject, or at least I think I am. Please can someone help me, before I loose my mind.
Here is my code:
Dim colScroll As New Collection
Private sFrame As String
If sFrame = "Frame" & CStr(1) Then
For Num = 1 To colScroll.Count
colScroll.Remove Num ' remove
Next
End If
sFrame = "Frame" & CStr(1)
Controls.Add "VB.Frame", sFrame, Me
'Position the frame and set its properties.
With Controls(sFrame)
.Top = 3960
.Left = 240
.Height = 1815
.Width = 5200
.BorderStyle = 0
.Visible = True
.ZOrder (0)
End With
' Maintain a collection of scrollbar values
colScroll.Add 0, sFrame
' Add 3 new controls to the frame.
'Combobox
Call Controls.Add("VB.ComboBox", "Combo" & CStr(nPtr), Controls(sFrame))
Load Combo0(1)
Set Combo0(1).Container = Controls(sFrame)
sValue = ""
With Combo0(1)
.Visible = True
.Width = 1580
End With
Thanks for everything!!!!!!!!
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
|