#### Archived

This topic is now archived and is closed to further replies.

# QUICK BUT URGENT VISUAL BASIC QUESTION!!!!!!!!

This topic is 6059 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

i wrote code for a program that prints rows of asteriks with four command buttons. I now have to change it into using one command button. Just copy/pasting under one command button isnt cutting it. Does anyone have any suggestions? I''VE TRIED EVERYTHING!!!!!!! Thank you heres my code with the four command buttons if it helps: Option Explicit Dim strb As String, stra As String, strc As String, strd As String Dim a As Boolean Dim b As Boolean Dim c As Boolean Dim d As Boolean Private Sub cmdb_Click() Cls stra = "" b = True Dim j As Integer For j = 10 To 0 Step -1 strb = String$(j, "*") If a = True Then stra = stra + "*" If Len(stra) > 10 Then stra = "" End If End If If c = True Then strc = Space$(10 - j) + String$(j, "*") If Len(strc) > 10 Then strc = "" End If End If If d = True Then strd = Space$(j) + String$(10 - j, "*") If Len(strd) > 10 Then stra = "" End If End If Print stra, strb, strc, strd Next j End Sub Private Sub cmdc_Click() Cls Dim j As Integer For j = 10 To 0 Step -1 c = True If a = True Then stra = stra + "*" If Len(stra) > 10 Then stra = "" End If End If If b = True Then strb = String$(j, "*") If Len(strb) > 10 Then strb = "" End If End If If d = True Then strd = Space$(j) + String$(10 - j, "*") If Len(strd) > 10 Then strd = "" End If End If strc = Space$(10 - j) + String$(j, "*") Print stra, strb, strc, strd Next j End Sub Private Sub cmda_Click() Dim i As Integer For i = 0 To 9 Step 1 a = True stra = stra + "*" Print stra Next i End Sub Private Sub cmdd_Click() Cls strd = "" Dim j As Integer For j = 10 To 0 Step -1 If a = True Then stra = stra + "*" If Len(stra) > 10 Then stra = "" End If End If If b = True Then strb = String$(j, "*") If Len(strb) > 10 Then strb = "" End If End If If c = True Then strc = Space$(10 - j) + String$(j, "*") If Len(strc) > 10 Then strc = "" End If End If strd = Space$(j) + String\$(10 - j, "*") Print stra, strb, strc, strd Next j End Sub Private Sub Label1_Click() End Sub Private Sub Form_Load() a = False b = False c = False d = False End Sub

1. 1
Rutin
32
2. 2
3. 3
4. 4
5. 5

• 11
• 10
• 13
• 95
• 11
• ### Forum Statistics

• Total Topics
632973
• Total Posts
3009634
• ### Who's Online (See full list)

There are no registered users currently online

×