vb.net
MODS: sorry bout the last post, thought i was in the Dev Center. and, this is not the same as my other topic, this concerns console apps..
so, i finally got my prime numbers app working, for a regular vb.net program (GUI). But i would like to do it with a console app. (for running it on low spec systems Laughing )
Normally, i would use an application.doevents command to update it each time in the loop, so it would not think its in an infinite loop. (thus being able to see the numbers scroll, and ability to pause is granted.)
But in the console app type, there is no doevents.. (don't know why..) so now i have this code, but it doesnt show all the numbers.. just 2
(this is the GUI code, but modified to work with console)(i think) Laughing
just found out, if i hold down enter, numbers start to pop up, but with lots of space between them..
Code:
Dim intPrime As Long
Dim bool As Boolean
Dim intDivisor, intMod As Long
Dim strString As String
bool = True
intDivisor = 1
intPrime = 1
Do While bool = True
intPrime = intPrime + 1
If Console.ReadLine() = "stop" Then
bool = False
End If
Do
If Console.ReadLine() = "stop" Then
bool = False
End If
intDivisor = intDivisor + 1
intMod = intPrime Mod intDivisor
Loop While intMod <> 0
If intPrime = intDivisor Then
Console.WriteLine(intPrime)
intDivisor = 1
End If
Loop
Programming Question
Moderator: Moderators
