|
-
May 23rd, 2013, 07:16 AM
#9
Thread Starter
Junior Member
Re: Listing Prime numbers within a group of numbers
 Originally Posted by Joacim Andersson
First of all you only pasted one of the two functions I posted, you need both of them. Secondly you actually also need to call on them.
Is your TextBox a multiline TextBox? Wouldn't a ListBox be better to show the prime numbers?
I will assume that TextBox3 is a multiline textbox and that you want to show one prime number on each line.
Code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim lower, upper As Integer
If Integer.TryParse(TextBox1.Text, lower) AndAlso Integer.TryParse(TextBox2.Text, upper) Then
Dim primeNumbers() As Integer = GetPrimeNumbers(lower, upper)
Dim text As String = ""
For Each prime As Integer In primeNumbers
text &= prime.ToString() & vbCrLf
Next
TextBox3.Text = text
End If
End Sub
Thank you very much
This is exactly what I wanted
Have a really good day !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|