Quote:
Originally Posted by sweetzhay
i am just a bit confused here coz in while wend i cannot use the STEP like u use in for the step - 1 im a having a hardtime to convert it
For j = sides - 1 To 0 Step -1
Hi again
The code for your origional questions using While/Wend is as follows
- Option Explicit
-
Dim sides As Integer
-
-
Private Sub Command1_Click()
-
Dim i As Integer
-
Dim j As Integer
-
-
Label1.Caption = ""
-
sides = 5
-
j = 1
-
While j <= sides
-
i = 1
-
While i <= j
-
Label1 = Label1 & i & Space(1)
-
i = i + 1
-
Wend
-
Label1 = Label1 & vbCrLf
-
j = j + 1
-
Wend
-
End Sub
-
-
Private Sub Command2_Click()
-
Dim i As Integer
-
Dim j As Integer
-
-
Label1.Caption = ""
-
sides = 5
-
j = sides - 1
-
While j >= 0
-
i = sides - j
-
While i >= 1
-
Label1 = Label1 & i & Space(1)
-
i = i - 1
-
Wend
-
Label1 = Label1 & vbCrLf
-
j = j - 1
-
Wend
-
End Sub
-
-
Private Sub Command3_Click()
-
Dim i As Integer
-
-
Label1.Caption = ""
-
Label2.Caption = ""
-
sides = 10
-
i = 1
-
While i <= sides
-
If i Mod 2 = 0 Then
-
Label1 = Label1 & i & Space(1)
-
Else
-
Label2 = Label2 & i & Space(1)
-
End If
-
i = i + 1
-
Wend
-
-
End Sub
With regard your other questions, well, where do the permutations end !!
Without wishing to seem unhelpful, I think you should have enough info now to try things yourself so you can do whatever is required in future. It is the only way to learn !!
MTB