Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dim Question

Status
Not open for further replies.

tgmoon

Technical User
Jan 31, 2001
54
GB
If, for example i'm writing the following code:-

Dim EG1 as Boolean
Dim EG2 as Boolean
Dim EG3 as Boolean

EG1 = ToggleButton1.Value
EG2 = ToggleButton2.Value
EG3 = ToggleButton3.Value

But i've got EG's going up to EG30..... do I need to put each and everyone of them, or is there a quick way of doing it, so the codes isn't so long?
 


Hi,

How about using an array?
Code:
    Dim EG(1) As Boolean, i As Integer
    
    For i = 0 To 1
        EG(i) = Me.Controls("ToggleButton" & i + 1).Value
    Next

Skip,

[glasses] [red]Be Advised![/red] For those this winter, caught in Arctic-like calamity, be consoled...
Many are cold, but few are frozen![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top