VB 2005 高分求!完成后继续追加

来源:百度知道 编辑:UC知道 时间:2024/06/29 01:19:00
Request a number and call a Sub procedure to display a square having that number of stars on each side.
需要用VB 2005制作的代码.谢谢. QQ8963530

就是说如果我输入3
***
* *
***
是不是啊?

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer = CInt(InputBox("输入数字。", "输入", ""))
If i >= 1 Then
drawRec(i)
End If
End Sub

Private Sub drawRec(ByVal i As Integer)
Dim strRec As String = ""
For j As Integer = 1 To i
If j = 1 Or j = i Then
For k As Integer = 1 To i
If k = i Then
strRec &= "*" & vbCrLf
Else
strRec &= "*"
End If

Next
Else
For k As Integer = 1 To i
If k = 1 Then