please help with creating controls while the program is executing 
Author Message
 please help with creating controls while the program is executing

The number of checkboxes in need on my form is variable. I need
to create the checkboxes while the program is executing, just be-
fore the form is started.

Does anyone know if this is possible? If it is, please send me
an example.

Thank you.
Fran?ois Pellicaan



Wed, 18 Jun 1902 08:00:00 GMT  
 please help with creating controls while the program is executing
Fran?ois

Create a checkbox array. You can add checkboxes to the array at run time.
Personally I like to use arrays starting with number 1, but most people seem
to prefer 0-based arrays, so for now lets use 0-based.

On the form, place a checkbox (lets call it Check1). On the properties sheet
for the checkbox there is a property called "Index", set it to zero (the
default setting is no number at all)

In the general declarations section of the form, declare a variable for use
as a counter.

Dim NumOfCheck1 as Integer

Now write a sub for adding a checkbox, and one for removing a checkbox. Here
Im using three parameters, the caption I want the new checkbox to have, and
the top and left positions I want it to appear at.

Public Sub AddCheck(CheckCaption As String, CheckLeft As Long, CheckTop As
Long)
    NumOfCheck1 = NumOfCheck1 + 1
    Load Check1(NumOfCheck1)

    With Check1(NumOfCheck1)
        .Caption = CheckCaption
        .Left = CheckLeft
        .Top = CheckTop
        .Visible = True
    End With
End Sub

Public Sub RemoveCheck()
    If NumOfCheck1 > 0 Then

        Unload Check1(NumOfCheck1)
        NumOfCheck1 = NumOfCheck1 - 1

    End If
End Sub

You may have to alter the code for your specific purpose, but remember that
the position you place the checkbox is important. If you dont assign a
position but just create the checkbox it wont be visible. (Itll be off the
form)

--


Quote:
> The number of checkboxes in need on my form is variable. I need
> to create the checkboxes while the program is executing, just be-
> fore the form is started.

> Does anyone know if this is possible? If it is, please send me
> an example.

> Thank you.
> Fran?ois Pellicaan



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Msg Box help again PLEASE I am new to programming

2. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

3. Please, please help, I am desperated...:(

4. PLEASE, PLEASE HELP, am I going MAD - Generating Totals

5. * * * I am Creating an Encryption Program , hobby Crackers needed to test * * *

6. Creating a program group during Setup..please help

7. Help me create a hexagon control. Please

8. help please creating non vis visual controls

9. Please help me - Creating Controls with code in VB

10. Can anyone HELP me PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE

11. PLEASE HELP.How to control a program from another

12. Please Help: Error 429: Workspaces: Activex Control Cannot Create Object

 

 
Powered by phpBB® Forum Software