Create Label Object In Code 
Author Message
 Create Label Object In Code

Is it possible to create a label object in a code module or app that has
no GUI?  If so, how?

I'm trying to implement user font/color selections and I'd like a
generic label and combo box so that I can set the font on each to
determine the required size for my forms' controls.

mike



Fri, 11 Feb 2011 08:18:14 GMT  
 Create Label Object In Code
Set Label to AutoSize=True
An invisible Label can be used to determine size.  If does not have to be
visible.

If you want it off existing forms then ...
The easiest is to create a form (e.g. frmForLabel) , put the label on it
(lblALabel), load it but do not show the form.
Load / unload as necessary or just keep it loaded.

' air code follows
Dim fForLabel as frmForLabel

Public Sub SomeSub()

    if fForLabel is Nothing Then
       Set fForLabel = New frmForLabel
    endif
    Load fForLabel  ' not visible

   ' do something with the label lblALabel on this instance of frmForLabel
   fForLabel.lblALabel.Caption = "Size This"

   ' and whatever else

End Sub

Quote:

> Is it possible to create a label object in a code module or app that has
> no GUI?  If so, how?

> I'm trying to implement user font/color selections and I'd like a
> generic label and combo box so that I can set the font on each to
> determine the required size for my forms' controls.

> mike



Fri, 11 Feb 2011 09:18:01 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Create a label control with code

2. Hwo to create a label in code on the fly and set all of its properties

3. Hwo to create a label in code on the fly and set all of its properties

4. Creating labels or other objects at runtime

5. Source codes of a Label object

6. Creating Textboxes , Labels and Other Objects At RunTime

7. Binding Label Object to RecordSet in code

8. Make a Label from code without any pre-existing label on the form

9. Label objects vs. picture objects

10. Creating OLE-object using code

11. Creating Unbound Objects From Code

12. Coding VBA in a MS Word Object created in a Visio document

 

 
Powered by phpBB® Forum Software