C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Training   ASP.NET Web Hosting    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

Play Silverlight Games or Submit your Silverlight applications and earn 90% AdSense revenue.

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Resources » Code Snippets » VB.NET Syntax »

Generate All Prime No. Between Given Number


Posted Date: 04 Jul 2008    Resource Type: Code Snippets    Category: VB.NET Syntax
Author: AfsarMember Level: Bronze    
Rating: Points: 2



Public Class Form1
Dim X As Integer
Dim Y As Integer
Dim flag As Boolean

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ListBox1.Items.Clear()
For Y = 1 To Val(TextBox1.Text)
flag = True
For X = 2 To Y
If X = Y Then
If flag = True Then
ListBox1.Items.Add(Y)
Exit For
End If
Else
If (Y Mod X = 0) Then
flag = False
End If
End If
Next
Next
Label1.Text = "Total No. of Prime No. - " & ListBox1.Items.Count
End Sub
End Class




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Getting text from Text file
Previous Resource: Change Desktop Wallpaper using VB.NET
Return to Discussion Resource Index
Post New Resource
Category: VB.NET Syntax


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use