Making my code smaller

Lutoniall

New member
Local time
Today, 18:54
Joined
Nov 2, 2007
Messages
5
Is there any way of making this code smaller, thanks in advance:)

Code:
Case 0
line1.Visible = True
line2.Visible = True
line3.Visible = True
line4.Visible = True
line5.Visible = True
line6.Visible = True
line7.Visible = False
Case 1
line1.Visible = False
line2.Visible = False
line3.Visible = False
line4.Visible = True
line5.Visible = True
line6.Visible = False
line7.Visible = False
Case 2
line1.Visible = False
line2.Visible = True
line3.Visible = True
line4.Visible = True
line5.Visible = False
line6.Visible = True
line7.Visible = True
Case 3
line1.Visible = False
line2.Visible = False
line3.Visible = True
line4.Visible = True
line5.Visible = True
line6.Visible = True
line7.Visible = True
Case 4
line1.Visible = True
line2.Visible = False
line3.Visible = False
line4.Visible = True
line5.Visible = True
line6.Visible = False
line7.Visible = True
Case 5
line1.Visible = True
line2.Visible = False
line3.Visible = True
line4.Visible = False
line5.Visible = True
line6.Visible = True
line7.Visible = True
Case 6
line1.Visible = True
line2.Visible = True
line3.Visible = True
line4.Visible = False
line5.Visible = True
line6.Visible = True
line7.Visible = True
Case 7
line1.Visible = False
line2.Visible = False
line3.Visible = True
line4.Visible = True
line5.Visible = True
line6.Visible = False
line7.Visible = False
Case 8
line1.Visible = True
line2.Visible = True
line3.Visible = True
line4.Visible = True
line5.Visible = True
line6.Visible = True
line7.Visible = True
Case 9
line1.Visible = True
line2.Visible = False
line3.Visible = True
line4.Visible = True
line5.Visible = True
line6.Visible = False
line7.Visible = True
End Select
 
you could save the settings in a multi dimension array

but as youve done it, and the settings are pretty random, i wouldnt bother about it.
 
Seven Segment Display perhaps? A Line object has a Tag property and you could probably create code that cycles through all of the segments and turns them on or off depending on whether the tag property contains the value. What you have would probably run faster.
 

Users who are viewing this thread

Back
Top Bottom