English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Dim Band(1 To 10) As String
Dim TotalTickets As Long
Dim X As Integer
Dim SoldOut As Boolean
Dim TicketsSold(1 To 10) As Integer
Dim Counter As Integer

Private Sub cmdSoldOut_Click()
Counter = 1
Counter = Counter + 1
If TicketsSold(Counter) = 13000 Then
SoldOut = True
If True Then
txtSoldOut = "Sold Out"
Else
SoldOut = False
If False Then
txtSoldOut = "Not sold out"
Do
Loop Until SoldOut = True Or Counter = 10

End If
End Sub

2006-10-08 07:01:31 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

Dim Band(1 To 10) As String
Dim TotalTickets As Long
Dim X As Integer
Dim SoldOut(1 to 10) As Boolean
Dim TicketsSold(1 To 10) As Integer
Dim Counter As Integer

Private Sub cmdSoldOut_Click()
Counter = 0
Do
Counter = Counter + 1
If TicketsSold(Counter) = 13000 Then
SoldOut(Counter) = True
txtSoldOut = "Sold Out"
Else
SoldOut(Counter) = False
txtSoldOut = "Not sold out"
End If
Loop Until Counter = 10
End Sub

2006-10-08 07:23:15 · answer #1 · answered by Prancing Stallion 2 · 0 0

Below is the solution to your question:

Dim Band(1 To 10) As String
Dim TotalTickets As Long
Dim X As Integer
Dim SoldOut As Boolean
Dim TicketsSold(1 To 10) As Integer
Dim Counter As Integer

Private Sub cmdSoldOut_Click()
Counter = 1
SoldOut = False
TicketsSold(5) = 13000
Do
If TicketsSold(Counter) = 13000 Then
SoldOut = True
End If
Counter = Counter + 1
Loop Until SoldOut = True Or Counter = 10

If SoldOut = True Then
txtSoldOut = "Sold out"
Else
txtSoldOut = "Not sold out"
End If
End Sub

More free VB source codes here: http://smartcoder.awardspace.com


KaBalweg
http://smartcoder.awardspace.com

2006-10-09 04:44:10 · answer #2 · answered by dabsani 3 · 0 0

1. Your "code" is pseudo-code - not true code

2. Your Do..... Loop did nothing at all

3. Your Counter would always start at 2 as written.

Private Sub cmdSoldOut_Click()
Counter = 0
Do
Counter = Counter + 1
If TicketsSold(Counter) = 13000 Then
SoldOut = True
txtSoldOut = "Sold Out"
Else
SoldOut = False
txtSoldOut = "Not sold out"
End If
Loop Until SoldOut = True Or Counter = 10

End Sub

2006-10-08 14:33:27 · answer #3 · answered by Peter C 6 · 0 1

fedest.com, questions and answers