Solved

Control Array and For...Next Loop

Posted on 1998-08-05
3
135 Views
Last Modified: 2010-05-03
I am taking a class that has requested us to create a checker board.  I am having problems with clearing the board
and starting again.  I have a group array of labels for the checker squares.  I need to clear the BackColor from Blue to
white (vbwhite?), as well as set the focus to the TextBox control for the start value.  Here is my sample.  I can clear
the text boxes, but can not clear the labels and reset the program.  I am only clearing one of the 15 checkboxes (and I made sure that the label array was set up correctly)

Private Sub Command1_Click()
'clear input amount and outputs
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label1(Intex).BackColor = vbWhite


0
Comment
Question by:luna
  • 2
3 Comments
 

Author Comment

by:luna
ID: 1468066
Edited text of question
0
 

Accepted Solution

by:
zabman earned 50 total points
ID: 1468067
Use a FOR...NEXT LOOP!

Try the following:

Private Sub Command1_Click()
'clear input amount and outputs
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""

For Count = Min to Max              'where Min is the smallest,
  Label1(Count).BackColor = vbWhite 'and Max is the largest
Next Count                          'number in the array!

Hope this will not be considered cheating!

                            -- Neil Z. :-)

Send me a copy when your done, i'd like to see it!
0
 

Author Comment

by:luna
ID: 1468068
I will try it and let you know!  I don't consider it cheeting.  I have @ 3 projects that I was having problems with and the teacher is NO help at all.  I have been racking my brain for days...  I appreciate all of your help!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now