Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Vb6

  • 23-02-2004 05:07PM
    #1
    Closed Accounts Posts: 3


    Does any1 know a component in vb that acts the same way as autoNumber in Ms Access ?


Comments

  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    No, but you can write one in under a dozen lines of code, so I'm not really surprised.

    jc


  • Closed Accounts Posts: 3 jl2004


    dont mean do be a dumbass but im as much a newbie to vb as to boards.ie
    any chance of showin me the code?


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Describe what you want it for.....


  • Closed Accounts Posts: 24 Mazikeen


    The simplest implementation would be something like:
    Public Function getAutoNumber()
        Static iAutoNumber As Integer
        iAutoNumber = iAutoNumber + 1
        getAutoNumber = iAutoNumber
    End Function
    
    However it starts getting more complex as you introduce things such as multiple autonumber instances and persistance (where does your auto number go when you switch off your code?)


  • Closed Accounts Posts: 3 jl2004


    Thats grand, i have it figured out now, thanks.....


  • Advertisement
  • Closed Accounts Posts: 333 ✭✭McGintyMcGoo


    Thats grand, i have it figured out now, thanks.....


    ... "figured out" OR you just copied it exactly!!?? :D


Advertisement