• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

more control array help

Alright - I've got this working up until here...
Before I get too terribly far into this, I was hoping for some expert guidance. :^)

Here's where I'm at:
I've got a sstab with dynamically added tabs (if the user keys in data for 5 tabs, 4 more, on top of the initial 1, would be created).
Then, I want to have (for starters) 10 text boxes on each tab, each in a column of 5.


  txtBox1   txtBox2
   [...]
  txtBox9  txtBox10

and that, repeated for each tab.

I'm using txtData already (twice), so my first run-time txtData must start at 2.
Here's what I've got so far, I'm looking for help on establishing the positions for now.  I already have two form-level variables that could be reused here (intTop & intLeft)

    z=2
    For x = 0 To sstMain.Tabs  'Loop through each tab, until all have been touched
        For y = z To z + 4   'loop through 5 times, creating 10 textboxes
            sstMain.Tab = x   'set the tab to the current tab
            Load txtData(y)  'load a new text box
            With txtData(y)  
                Set .Container = sstMain   'establish it's container as the ssTab
                .Tag = sstMain.TabCaption(x)  'used to store a reference to the tab that's being used
                .Left = 280      '<----  Here's where I'm stuck.  The values here 'work' currently for the first text box, so
                .Top = 700        '         presumably this would need to be set before my loop.  
                .Width = 1000
                .Height = 100
                .Visible = True
            End With
            Load txtData(y + 1)  '2nd textbox being created (column 2)
            With txtData(y + 1)
                Set .Container = sstMain
                .Tag = sstMain.TabCaption(x)
                .Left = 1480
                .Top = 700
                .Width = 1000
                .Height = 100
                .Visible = True
            End With
        Next y
    Next x

I'm bored with coding today, so I took off my thinking cap.  Willing to offer 500 points to someone for some good help here.
I'm off to cut down a tree, so it may be a bit before I return to clarify anything...
Thanx!
0
sirbounty
Asked:
sirbounty
  • 5
  • 4
1 Solution
 
ShauliCommented:
Dim X As Integer, Y As Integer, Z As Integer, tCount As Integer
Z = 2
tCount = Z
For X = 0 To sstMain.Tabs - 1
    sstMain.Tab = X
    For Y = Z To Z + 10
        Load txtData(tCount)
        With txtData(tCount)
            Set .Container = sstMain
            .Tag = sstMain.TabCaption(X)
            .Left = IIf(Y Mod 2 = 0, 280, 1480)
            Debug.Print txtData(tCount - 1).Top
            .Top = IIf(tCount Mod 2 = 0, IIf(tCount Mod 10 = Z, 700, 700 + txtData(tCount - 1).Top), txtData(tCount - 1).Top)
            .Width = 1000
            .Height = 100
            .Visible = True
            tCount = tCount + 1
        End With
    Next Y
Next X
sstMain.Tab = 0

S
0
 
sirbountyAuthor Commented:
First thing - these new text boxes are filled with the text value of txtData(0)...
Secondly, they're just a bit too far apart on the vertical (horizontal looks great).
0
 
sirbountyAuthor Commented:
Ok, that's taken care of.
I'm setting the Text with another IIF.
And I've reduced 700 to 500 and they look fine now.

However, if I'm trying to set the left box to A and the right box to B, how would I do that properly?
It's currently only working on every other tab...

  .Text = IIf(tCount Mod 2 = 0, "A", "B")

I'll be opened another question on adding a second set of columns on each tab, if all 5 are filled.  If you'd like, I can drop a pointer here.
Thanx Shauli :^)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ShauliCommented:
How do you fill with text? I mean, do all left column on a given tab the same? and then all boxes on the right column the same? Or is it different text for each box?

S

ps. I have 2 doomed trees in my back yard :)

S
0
 
sirbountyAuthor Commented:
Haha - I've got one ginormous pine on my side lot that I'm still debating what to do...it won't hit 'my' house...but there's a (although very slim) chance it could hit at most the neighbor's fence...  Two estimates - completely different - neither 'pleasing'.  I wish there was a professional 'where's the tree going to fall when it drops' person...life would be much easier!

Anyway - yes, these are just 'defaults', so all 'left' boxes should be "A" (example) and all right should be "B" on all tabs...
0
 
ShauliCommented:
I live in the "country", or if you wish, in the forest. And these two are dead, but yet stand still. One is threatening my house and other my neighbor's. I will have to deal with them during the summer.

 .Text = IIf(Y Mod 2 = 0, "A", "B")

Would do...

S
0
 
sirbountyAuthor Commented:
Cool - trying it now.

So...vroom vroom!  I've been up in a tree every day this week - raising the canopy a bit so I can get sun on that soon-to-be-delivered sod. :^)
0
 
sirbountyAuthor Commented:
Good luck with those trees!
Thanx, as always. :^)
0
 
ShauliCommented:
Thanks, I hate to bring them down, but i"ll have to. Have fun.

S
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now