Dynamic creation of Control Array on a SSTab 
Author Message
 Dynamic creation of Control Array on a SSTab

I am trying to add DbGrids to a SSTab control in runtime and form a Control
Array.

I can control the number of tabs dynamically. But I am having difficulty
adding a control e.g. DbGrid, to any specific tab.

Thanks in advance

Anthea Carson



Sun, 28 Feb 1999 03:00:00 GMT  
 Dynamic creation of Control Array on a SSTab

Quote:

> I am trying to add DbGrids to a SSTab control in runtime and form a Control
> Array.

> I can control the number of tabs dynamically. But I am having difficulty
> adding a control e.g. DbGrid, to any specific tab.

> Thanks in advance

> Anthea Carson

Hi There Anthea,

I wrote a sample file that added a list control to a tab when I
clicked the form. The list had to be part of a control array i.e.
at design time create a control array for the list and then when
you run the program you can have as many lists/dbgrids as you want.
You MUST have a control array set up to start with at least that's
what the on line help says. It is the only way to dynamically
create controls at run time. For the on-line help type
"control arrays" then return, select "Adding and Deleting Controls
at Run Time" and the help file will have all the details. (note :
this is VB4.0). Feel free to contact me if you need any more help.
Cheers,

Dave.

Sample code for displaying a list on a tab control

Public tmp As Integer ' store in global.bas module

Private Sub Form_Load()

    tmp = 0

End Sub

Private Sub Form_Click()

    'special case for first tab
    If SSTab1.Tabs = 1 Then
        SSTab1.TabsPerRow = 2
    Else
        SSTab1.TabsPerRow = SSTab1.Tabs / 2 + 1
    End If
    SSTab1.Tab = 0
    SSTab1.Tabs = SSTab1.Tabs + 1
    SSTab1.Tab = SSTab1.Tabs - 1
    tmp = tmp + 1
    Load list1(tmp)
    Set list1(tmp).Container = SSTab1
    list1(tmp).Visible = True
    If (SSTab1.Tabs = 1) Or (SSTab1.Tabs = 2) Then
        list1(tmp).Top = 400
    Else
        list1(tmp).Top = 700
    End If
    list1(tmp).Left = 240

End Sub

--

David Nicoll
Analyst/Programmer
Imajica.
10 Queens Rd,
Aberdeen. AB15 4ZT.

p : 01224 634342
f : 01224 634344

w : http://www.imajica.co.uk

--

David Nicoll
Analyst/Programmer
Imajica.
10 Queens Rd,
Aberdeen. AB15 4ZT.

p : 01224 634342
f : 01224 634344

w : http://www.imajica.co.uk



Tue, 02 Mar 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Controls on dynamic SSTab control

2. Dynamic Controls Creation and Referencing the new Control.

3. Dynamic Control Creation, Controls object has no .Add ???

4. Unloading control arrays on sstab control error

5. Placing Dynamic Controls on SSTab

6. Dynamic creation of web controls in VB.NET

7. Dynamic Control Creation - Expand Form?

8. Dynamic Creation of Controls

9. Dynamic control creation

10. Dynamic control creation and calling DOS programs from VB.

11. dynamic creation of controls?

12. VB6-Dynamic Control Creation

 

 
Powered by phpBB® Forum Software