Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I've gotten solutions within a day - it saved a lot of time and actually got me one ATTABOY from my boss..."

Geography

Where in the world do Tek-Tips members come from?
BigBart (Programmer)
12 May 12 13:53
I have a program that needs to have controls identified as a two deminsional array. An example is a BINGO card where each number on the card is a text or label control and has an name ID of a row and a column...much like cells in Excel. Can this be done? I can nwork around it and program it in a funky fashion, but it will not be eloquent with For..Next loops.

Second. I have a frmMain screen for startup. This gets a list of who is attending the Bingo game. When I call the BINGO form from the main form, it spends several seconds generating a bingo card full of controls for each player at the game. Can I generate the person's bingo card in the background while I am in the Main form adding to people to the game as they sign in? Then just turn form to visible when I call it. What will this do to memory, performance, etc.?
SkipVought (Programmer)
14 May 12 7:36
What have you got so far?

Please tell us where you are stuck.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

BigBart (Programmer)
14 May 12 10:10
I have to create a row of text boxes dynamically for each person playing in my game. This is on screen 2. Screen 1 is a list of those people who show up for the game and assigns them a table. Each person gets a row on screen 2 showing their past scores. For now, I now use a control I created on screen 2 called txtScore(0) I use it as a "seed" control. When I enter Screen 2, I dynamically create the correct number of txtScore() controls based upon the number of scores this person has made in the past. I use: Load txtScore(i) to make a copy of the txtScore(0) in a For-Next loop.

Now I want to change txtScore(0) to txtScore(0,0) so I can put multi people on the screen instead of just one. I don't know how to create this new two-dimensional arr. That is problem 1.

Problem 2: When everyone has arrived and I need to show the txtScores form, it takes several seconds for the form to dynamically create all the text boxes on the screen and show the form. I don't know if the time is spent creating the controls or swapping memory to unload screen 1 and load screen 2. I thought I could create the txtScore(i) controls required for each person as they arrive and are added to the Screen 1 by creating them invisibly on screen 2. Then change the screen 1 to invisible and screen 2 to visible when I am ready for it. Not sure how memory is handled in VB6. Would this be worth the effort?
SkipVought (Programmer)
14 May 12 10:49

Quote:

I don't know how to create this new two-dimensional arr
Have you looked at VB Help on arrays?

You have not displayed any of the code where this issue is processed.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

tedsmith (Programmer)
24 May 12 9:37
You need to have your data in an array (DataArray(100,100) and and calculate a single number for the text box index from the two elements of the data array.
You cant have the index for the control in more than one dimension but you could have the first lot atarting at 1 and the second at 10 third at 20 so all you have to do is multiply the index by the (person-1) to indicate which person boxes are used

When showing a grid, for speed, put the text boxes in an invisible indexed frame and only show the frame when the last box is created.You can dynamically load the text boxes at run time by starting with one invisible text box indexed to 0. It should show instantly on a reasonable computer.

To create a say 7 x 5 grid Bingo grid say you use -
a=0 (or 36 for second set etc)
For h=0 to 6
For v=0 to 4
a=a+1
Load txtBox(a)
txtBox(a).text= Your data whatever -
txtBox(a).move h*1200,v*1200,1000,1000
txtBox(a).visible=true
Frame1.visible=true

This creates 35 boxes
For a subsequent set of buses just start "a" at 36 and have the data in arrays also starting at 36. Put each grid in a different frame. You could have many frames with some hidden.

dilettante (MIS)
24 May 12 11:11
Sounds like a good case for a UserControl that can deal with the mapping between (row, col) and control array index.

Hard to imagine that generating a card "takes seconds" and needs to be handled as some sort of background task.
BigBart (Programmer)
25 May 12 21:12
Thanks, Ted. Some excellent ideas.

I agree about the time, dilettante. However, I can count to two while I go from the main screen to the results screen. This is on a laptop using Vista. It is very fast with windows 7 on my desktop. Leads me to think it is memory management.
dilettante (MIS)
26 May 12 2:39
Um, no. It probably isn't tree spirits either.

Speed can be related to memory but more likely you just have some really slow code. Use a profiler and it may open your eyes pretty wide.
BigBart (Programmer)
27 May 12 14:15
I suspect I have gotten into some loops not really needed. Thanks for the reply. I will check this out.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close