Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Collection Problem
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Collection Problem
Miscellaneous
Thread ID:
00784441
Message ID:
00784441
Views:
71
I'v added a control dynamically, and now I want to place
the control in a collection. I'm getting the error
"Object variable or With block variable not set" on the bold line:


Private WithEvents ctlExtender As VBControlExtender
Private Headers As Collection


Public Function AddGroup(Caption As String) As Object

Dim sName As String
Dim iGroup As Integer

iTotHeaders = iTotHeaders + 1
sName = "Header" + LTrim(Str(iTotHeaders))

Set ctlExtender = Controls.Add("SuperSideBar.crlButton", sName)

With ctlExtender

.Alignment = 1
.Caption = Caption
.Left = 10
.Top = 10
.Width = UserControl.Width - 23

.Visible = True

End With


Headers.Add ctlExtender, sName


Set AddGroup = ctlExtender

End Function
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform