Translate

วันเสาร์ที่ 25 กุมภาพันธ์ พ.ศ. 2560

Create random single value in VB of visual studio.net 2012

Create random single value in VB of visual studio.net 2012

1. Open window application form
2.Design a form  with text-box and button objects

* change the label name and button near your design for understand.

3. Write the code in the button

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        'Create an variable of random function
        Dim random1 As New Random()
        Dim randomvalue As Integer

       ' Define your range require integer only
        randomvalue = random1.Next(1000)

        TextBox1.Text = randomvalue
    End Sub

4. Click start and click Random button for random number.




Enjoy !.