locked
how to make auto numbers? RRS feed

  • Question

  • hi......how to make an auto numbers? i'm creating a ticketing system which the ticket starts at smp-2000(textbox)... when i create another ticket the ticket will now increament to 1(smp-2001)....and so-on, and another thing once i close my app and open it... the ticket will now continue the count(not back to smp-2000 again)

     

    Wednesday, February 28, 2007 3:50 AM

Answers

  • From the menu, select Project, then the last option listed ("Project Name" Properties).  This should bring up a side-tab panel.  Select the Settings Tab.  Enter the name of your setting, its data type, and set Scope to Application.

    In your code, refer to the setting with the My.Settings namespace.  Be sure to save the settings whenever you change them (and want to keep the changed value).

    Thursday, March 1, 2007 5:23 PM

All replies

  • You will need to save the ticket number to an external text file and retrieve it each time you start the app.  The ticket number would begin with 0 when you start the app for the first time.  You initialize it as:
    ticket += 2000 when you start the app each time.  Then you can use a loop to increment by one for each new ticket.

     

     

     

    Wednesday, February 28, 2007 5:30 AM
  •  

    save it to a settings file

     

    Wednesday, February 28, 2007 12:30 PM
  • You’re creating a system and i presume you stores all transaction happened. You can store it on your database so you can retrieve your most recent number and continue your number as you go on with your daily transaction.


    or

    You can create another text file where it will store the most recent value of your auto-number transaction

    Good luck


    Wednesday, February 28, 2007 2:24 PM
  • Since it is only a single number that you need to keep track of use Renee's suggestion and store the value as an Application Setting.  That would be the most efficeint means to store and retrieve the number
    Wednesday, February 28, 2007 5:39 PM
  • what do u mean in application settings? site an example please?
    Thursday, March 1, 2007 12:16 AM
  • From the menu, select Project, then the last option listed ("Project Name" Properties).  This should bring up a side-tab panel.  Select the Settings Tab.  Enter the name of your setting, its data type, and set Scope to Application.

    In your code, refer to the setting with the My.Settings namespace.  Be sure to save the settings whenever you change them (and want to keep the changed value).

    Thursday, March 1, 2007 5:23 PM