Solved

Working with a VB control

Posted on 2002-06-04
4
131 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
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

910 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now