VB编程题,在文本框Text1中输入一个正整数,单击Command1,在Text2中显示一系列数字,规律如下图所示。 5
展开全部
下面是简单实现,需要带入参数是大于等于1的正数(自己防呆)
Private Sub Command1_Click() '调用实例
Dim str As String
MsgBox return_str(5)
End Sub
Private Function return_str(number As Integer) As String '通用函数
Dim str As String
For i = 1 To number
Dim str_temp As String
str_temp = ""
' MsgBox str_temp
For j = 1 To i
str_temp = str_temp & CStr(i)
Next
str = str & str_temp
Next
return_str = str
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询