vb!請一教我vb寫code同改!
1
22
333
4444
55555
666666
7777777
88888888
999999999
我想問下,呢個數字既3角型,用vb點寫!
請求救!
Module Module1
Sub Main()
Dim i, k As Integer
Dim result1 As String
Dim result2 As String = ""
For i = 1 To 9
result1 = ""
For k = 1 To 9
result1 = result1 & i & "*" & k & "=" & i * k & Chr(9) 'chr(9)
Next
result2 = result2 & result1 & Chr(13) 'chr(13)
Next
MsgBox(result2)
End Sub
End Module
也可以用以上的code改一改吧;謝謝!`
回答 (3)
✔ 最佳答案
N年冇用過VB... 即管試試.....
Dim i, k As Integer
Dim result As String
For i = 1 To 9
For k = 1 To i
result += i.toString()
Next
result += vbNewLine
Next
MsgBox(result);
2011-03-22 22:25:02 補充:
可能要比埋default value先得
Dim result As String = ""
Sub main()
Dim NumX, NumY, PrintTree
For NumX = 1 To 9
If NumX > 1 Then
PrintTree = PrintTree & Chr(10)
End If
For NumY = 1 To NumX
PrintTree = PrintTree & NumX
Next NumY
Next NumX
Response = MsgBox(PrintTree, 0, "Number Tree"
End Sub
Sub Main()
Dim i, k As Integer
Dim result1 As String
Dim result2 As String
result2 = ""
For i = 1 To 9
result1 = ""
For k = i To 1 Step -1
result1 = result1 & i
Next
result2 = result2 & result1 & Chr(13)
Next
MsgBox (result2)
End Sub
收錄日期: 2021-04-13 17:52:55
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20110322000051KK01286
檢視 Wayback Machine 備份