title: Call a Sub in a Textbox VB.Net
body: <p><a href="https://stackoverflow.com/questions/59300193/get-all-combinations-which-declares-an-established-amount-sum">Get all combinations which declares an established amount sum</a></p>
  
  <p>I managed to convert the code written to C #, and I would need some help. I don't know how to let them display the appropriate values in my Textbox.</p>
  
  <pre><code> Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      ' Call (Main) - How to call in a Textbox1.Text
      End Sub
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>Class SurroundingClass
      Private Sub Main()
          Dim numbers As Integer() = {3, 9, 8, 4, 5, 7, 10}
          Dim target As Integer = 15
          sum_up(New List(Of Integer)(numbers.ToList()), target)
      End Sub
  
      Private Shared Sub sum_up_recursive(ByVal numbers As List(Of Integer), ByVal target As Integer, ByVal part As List(Of Integer))
          Dim s As Integer = 0
  
          For Each x As Integer In part
              s += x
          Next
  
          If s = target Then
              Console.WriteLine("sum(" &amp; String.Join(",", part.[Select](Function(n) n.ToString()).ToArray()) &amp; ")=" + target)
          End If
  
          If s &gt;= target Then
              Return
          End If
  
          For i As Integer = 0 To numbers.Count - 1
              Dim remaining = New List(Of Integer)()
              Dim n As Integer = numbers(i)
  
              For j As Integer = i + 1 To numbers.Count - 1
                  remaining.Add(numbers(j))
              Next
  
              Dim part_rec = New List(Of Integer)(part)
              part_rec.Add(n)
              sum_up_recursive(remaining, target, part_rec)
          Next
      End Sub
  
      Private Shared Sub sum_up(ByVal numbers As List(Of Integer), ByVal target As Integer)
          sum_up_recursive(numbers, target, New List(Of Integer)())
      End Sub
  End Class
  </code></pre>