I'm trying to do the Peter's Petrol Pumps coursework set by the AQA board for this year's CPT3 Project. So far I have worked out everything apart from the LCD display, and I am quite far ahead of everyone else in my class. Being ahead of everyone else, it is almost impossible to ask my teacher for help as he says I don't need it until everyone else is at my level. I have three problems:
1) I have 91 Pictureboxes as my LCDs (2 pictures, one for horizontal, one for vertical). The coding seems to work, but then the LCDs don't actually change, so I guess that would be my biggest problem...
2) My Pictureboxes are named "PB1A", "PB2A", "PB1F", "PB2F" etc, I was trying to see if I could create a For...Next Loop to refer to each of them, instead of having to individually go through them as in the example below:
CODE
LCD(7, 0) = PB1A.Visible
LCD(8, 0) = PB1N.Visible
LCD(9, 0) = PB1C.Visible
LCD(10, 0) = PB1D.Visible
LCD(10, 0) = PB1E.Visible
etc
I would rather have the 31 lines (or similar) as shown below, or have another simpler way of doing it, than having 91 lines like those in the above coding. I was wondering if it was actually possible to do something like this, and if so, how, because this coding doesn't work... ^^;
CODE
Dim LCD(12, 6) As Boolean
Dim LCDSubstring(11) As Integer
Dim X, Y As Integer
Dim Z As String
Dim IndividualLCD As String
Sub LCDSub()
For X = 0 To 11
For Y = 0 To 6
If X = 0 Then
Z = "F"
ElseIf X = 1 Then
Z = "G"
ElseIf X = 2 Then
Z = "H"
ElseIf X = 3 Then
Z = "J"
ElseIf X = 4 Then
Z = "K"
ElseIf X = 5 Then
Z = "L"
ElseIf X = 6 Then
Z = "M"
ElseIf X = 7 Then
Z = "A"
ElseIf X = 8 Then
Z = "N"
ElseIf X = 9 Then
Z = "C"
ElseIf X = 10 Then
Z = "D"
ElseIf X = 11 Then
Z = "E"
End If
IndividualLCD = "PB" & (Y + 1) & Z
LCD(X, Y) = IndividualLCD.Visible
Next
Next
LCDSubstring(0) = lblATP.Text.Substring(0)
LCDSubstring(1) = lblATP.Text.Substring(1)
LCDSubstring(2) = lblATP.Text.Substring(2)
LCDSubstring(3) = lblATP.Text.Substring(4)
LCDSubstring(4) = lblATP.Text.Substring(5)
LCDSubstring(5) = lblLitres.Text.Substring(0)
LCDSubstring(6) = lblLitres.Text.Substring(1)
LCDSubstring(7) = lblLitres.Text.Substring(3)
LCDSubstring(8) = lblPpL.Text.Substring(0)
LCDSubstring(9) = lblPpL.Text.Substring(1)
LCDSubstring(10) = lblPpL.Text.Substring(2)
LCDSubstring(11) = lblPpL.Text.Substring(4)
For Me.Z = 0 To 11
If LCDSubstring(Z) = 0 Then
For Me.Y = 0 To 6
If Me.Y = 3 Then
LCD(Z, Y) = False
Else
LCD(Z, Y) = True
End If
Next
ElseIf LCDSubstring(Z) = 1 Then
For Me.Y = 0 To 6
If Me.Y = 2 Or Me.Y = 5 Then
LCD(Z, Y) = True
Else
LCD(Z, Y) = False
End If
Next
ElseIf LCDSubstring(Z) = 2 Then
For Me.Y = 0 To 6
If Me.Y = 1 Or Me.Y = 5 Then
LCD(Z, Y) = False
Else
LCD(Z, Y) = True
End If
Next
ElseIf LCDSubstring(Z) = 3 Then
For Me.Y = 0 To 6
If Me.Y = 1 Or Me.Y = 4 Then
LCD(Z, Y) = False
Else
LCD(Z, Y) = True
End If
Next
ElseIf LCDSubstring(Z) = 4 Then
For Me.Y = 0 To 6
If Me.Y = 0 Or Me.Y = 4 Or Me.Y = 6 Then
LCD(Z, Y) = False
Else
LCD(Z, Y) = True
End If
Next
ElseIf LCDSubstring(Z) = 5 Then
For Me.Y = 0 To 6
If Me.Y = 2 Or Me.Y = 4 Then
LCD(Z, Y) = False
Else
LCD(Z, Y) = True
End If
Next
ElseIf LCDSubstring(Z) = 6 Then
For Me.Y = 0 To 6
If Me.Y = 2 Then
LCD(Z, Y) = False
Else
LCD(Z, Y) = True
End If
Next
ElseIf LCDSubstring(Z) = 7 Then
For Me.Y = 0 To 6
If Me.Y = 0 Or Me.Y = 2 Or Me.Y = 5 Then
LCD(Z, Y) = True
Else
LCD(Z, Y) = False
End If
Next
ElseIf LCDSubstring(Z) = 8 Then
For Me.Y = 0 To 6
LCD(Z, Y) = True
Next Y
ElseIf LCDSubstring(Z) = 9 Then
For Me.Y = 0 To 6
If Me.Y = 5 Then
LCD(Z, Y) = False
Else
LCD(Z, Y) = True
End If
Next
End If
Next Z
End Sub
3) Our college is using an earlier version of VB than I am on my computer at home... is there a way that I can save the project in the earlier version's format? otherwise I can't actually open my project at college, which kind of defeats the puropse of it....
Thanks for reading, and thanks in advance for any help given ^^
-Sonya
This post has been edited by Sonyaswan: 26 Feb, 2008 - 02:30 PM