Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


VB.NET Faces Off Against Classic VB : Page 3

VB.NET, the .NET Framework, and Visual Studio.NET together form a potent combination that can simplify your code and reduce errors; however, to truly supplant existing versions of VB as a RAD tool, Visual Studio needs Break-Edit-Continue.




Application Security Testing: An Integral Part of DevOps

Retrieve a random number within a specified range
This is a common task, but the syntax always seemed awkward in classic VB. It's been cleaned up considerably in VB.NET. To get a random number, simply call the Next method of the System.Random object. The overloaded version shown below returns a random number between two specified Integer values. The Random object seeds itself automatically using a time-dependent value.

Classic VB:

   Private Function getRandomNumber _
      (low As Long, high As Long) As Long
      getRandomNumber = CInt((high - low + 1) * _
         Rnd + low)
   End Function


   Private Function getRandomNumber _
      (ByVal low, ByVal high) As Integer
      getRandomNumber = New System.Random(). _
         Next(low, high)
   End Function

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date