Dear All,


How can i auto generate number in vb.net

Please help thanks in advance for your help

Hi,

Here's a way how to do it.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim Low As Integer = 0
        Dim High As Integer
        High = 10 ' max integer
        Get_Random(Low, High)


    End Sub

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

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

    End Sub

Thanks for your help nut it s generating 7 by default.

I want to generate auto number every time when form loaded please help me.

Hi,

On form load, try this;

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Randomize()
        TextBox1.Text = Int(Rnd() * 10)

    End Sub

it is generating 7 every time form load ok let me explain

1. I want to generate auto number stating from 1
2. Then i want to increment it at evey transaction.

or

Is it possible that it every time generate auto number every time when form loaded?

Please help me if it is possible.