I just want to know how Can I display an asterisk pattern like

if the user selects on the combobox.additem = 1 then it will display

*
**
***
**
*

If user selects combobox.additem= 2 then

*
**
***
**
*
**
***
**
*

then so on and so forth until combobox.additem =2

Following were the codes that I have used...

Thank YOu

Dim x As Integer
Dim y As String


Private Sub cmdCreate_Click()
y = "*"
Wave = cboWave.Text

If Wave = "1" Then
x = 5
Do
Print y
x = x - 1
y = y + "*"
Loop Until x = 2

End If
End Sub

Try the following code. I have changed your if then to a select statement. When the "*" gets to 4, it counts back 1 at a time by removing the last "*" -

Option Explicit

Private Sub Command1_Click()

Dim x As Integer, z As Integer
Dim y As String, Wave As String

x = 5
z = 3
y = "*"
Wave = cboWave.Text

Select Case Wave

Case 1
    Do
    Print y
    x = x - 1
    y = y + "*"
    Loop Until x = 2
    
    Do
    Print y
    If y = vbNullString Then
        Exit Sub
            Else
        y = Left$(y, Len(y) - 1)
    End If
    Loop Until x = 0
End Select
End Sub

Just play around if user selects 2, 3, 4 etc from combobox.

thanks for the help

Only a pleasure. If this solved your problem, please mark it as solved, thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.