Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim endCount As Integer = 1000 Dim finished As Boolean = False Dim n1 As Integer = 0 ' 0, 1, 2, 3.. Dim n2 As Integer = 0 ' 10, 20, 30.. Dim n3 As Integer = 0 ' 100, 200, 300.. Dim n4 As Integer = 0 ' 1000, 2000, 3000.. For I As Integer = 1 To 1000 While finished = False n1 += 1 If n4 * 1000 + n3 * 100 + n2 * 10 + n1 = endCount Then finished = True End If If n1 = 10 Then n1 = 0 n2 += 1 If n2 = 10 Then n2 = 0 n3 += 1 If n3 = 10 Then n3 = 0 n4 += 1 End If End If End If Dim msg As String = n4.ToString() + n3.ToString() + n2.ToString() + n1.ToString() TextBox1.Text = TextBox1.Text & vbCrLf & msg End While Next End Sub End Class