This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Thursday, January 22, 2009

Random number generator (VB.NET)

Random number generator (VB.NET)

Version: VB 2005
Compatibility: VB 2005
Category: Mathematics

Grabs a random number between two designated, or user input designated numbers. VB.NET

Declarations:
In the instance i have used this, Low is a variable set by the program, not the user. High is based on user input. To allow the user to choose also the low number, just edit and follow the basis for High.

HighNum is a Textbox
Number is a label, in the program i started with this label hidden until the number is generated.

Get_random is the number generated itself. How it works speaks for itself.

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim Low As Integer = 1
Dim High As Integer
High = HighNum.Text
Get_Random(Low, High)
Number.Visible = True
Beep()
End Sub

Sub Get_Random(ByVal Low As Integer, ByVal High As Integer)

Number.Text = Math.Floor((High - Low + 1) * Rnd() + Low)

End Sub

1 comments:

Anonymous said...

your background & link colour sucks..hard to read it..

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Blog Archive

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger