Working with a VB control

I am wondering how you instatiate a vb conrtol through code

I need to use a label without actually placing one on a form I ws thiking it would be something like this but obviously it didn't work :-)

Dim lblLabel as Label

  Set lblLabel = new Label
  lblLabel.width = 400

Who is Participating?
bobbit31Connect With a Mentor Commented:
Dim myLabel As Label
Set myLabel = Form1.Controls.Add("VB.Label", "myLabel")

myLabel.width = 400
Richie_SimonettiIT OperationsCommented:
and, if i am not wrong and you want to access events too:
dim withevents myLabel as label
pgarnAuthor Commented:
thnx great answer
your welcome :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.