i already have the code to produce triangles made of asterisks as follows:
i know that i have to adust the form and add the textboxes and labels, but i cant for the life of me figure out the code to allow users to enterin the number of rows and columns. in other words provide textboxs to enter the size of the triangles and the symbol to print. Print the triangles only when size is between 3 and 15, inlcusive. Also, provide "Print Triangles" and "Clear Traingles" buttons that perform the appropriate task. Any Ideas?
Public Class Form1
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'pattern A
For n = 1 To 10
For i = 1 To n
TextBox1.Text = TextBox1.Text & "*"
Next
TextBox1.Text = TextBox1.Text & vbNewLine
Next
'pattern B
For n = 10 To 1 Step -1
For i = 1 To n
TextBox1.Text = TextBox1.Text & "*"
Next
TextBox1.Text = TextBox1.Text & vbNewLine
Next
TextBox1.Text = TextBox1.Text & vbNewLine
'pattern C
For n = 10 To 1 Step -1
For blank = 10 - n To 1 Step -1
TextBox1.Text = TextBox1.Text & " "
Next
For i = 1 To n
TextBox1.Text = TextBox1.Text & "*"
Next
TextBox1.Text = TextBox1.Text & vbNewLine
Next
'pattern D
For n = 10 To 1 Step -1
For blank = n - 1 To 1 Step -1
TextBox1.Text = TextBox1.Text & " "
Next
For i = 10 - n + 1 To 1 Step -1
TextBox1.Text = TextBox1.Text & "*"
Next
TextBox1.Text = TextBox1.Text & vbNewLine
Next
TextBox1.Text = TextBox1.Text & vbNewLine
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
End Sub
End Class
i know that i have to adust the form and add the textboxes and labels, but i cant for the life of me figure out the code to allow users to enterin the number of rows and columns. in other words provide textboxs to enter the size of the triangles and the symbol to print. Print the triangles only when size is between 3 and 15, inlcusive. Also, provide "Print Triangles" and "Clear Traingles" buttons that perform the appropriate task. Any Ideas?