I have to write a program which on button click, generates a diamond shape. The diamond shape must be of size 32 (rows and columns) and each row/column increments by +/- 2 beginning at 1.
Here is what I have come up with so far, how can I display this diamond in a multiline textbox?
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim row As Integer
Dim column As Integer
For i As Integer = 0 To 15 Step 2
If row = i Or _
column = i Then
TextBox1.Lines(i) = "O"
For o As Integer = 16 To 32 Step -2
If row = o Or _
column = o Then
TextBox1.Lines(o) = "O"
Not looking for a full solution here, just a push in the right direction. Thanks in advance!
TextBox1.Font = New System.Drawing.Font("Courier New", 9.0F) Dim n As Integer = 7 For i As Integer = 1 To 15 Step 2 Dim s As String = "" s = StrDup(n, " ") & StrDup(i, "*") TextBox1.Text = TextBox1.Text & s & vbCrLf n = n - 1 Next