Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Working with a VB control

Posted on 2002-06-04
4
Medium Priority
?
138 Views
Last Modified: 2010-05-02
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

0
Comment
Question by:pgarn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 200 total points
ID: 7054259
Dim myLabel As Label
Set myLabel = Form1.Controls.Add("VB.Label", "myLabel")

myLabel.width = 400
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7054278
and, if i am not wrong and you want to access events too:
dim withevents myLabel as label
0
 

Author Comment

by:pgarn
ID: 7054399
thnx great answer
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7054404
your welcome :)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question