Results 1 to 2 of 2

Thread: Saving lottery numbers in a database, in VB.4.0

  1. #1
    Rickey
    Guest

    Saving lottery numbers in a database, in VB.4.0

    How do I create a database program in VB4.o to hold the numbers generated as random numbers to a database, with the day and year. And then be able to retrieve them at anytime

    Also how can I make this ainto a option for the user to pick as many sets of numbers as the user wants eg. win 4 99 sets of four random numbers without repeating the numbers already chosen?




    This is the code written so far


    Private Sub Command1_Click()

    Dim Lottery(6) As Integer ' array to hold final selected numbers
    Dim nLucky As Integer ' variable to hold each random selection
    Dim nCount As Integer ' counter for number of selections made
    Dim nCheck As Integer ' counter for check on previous selections

    For nCount = 1 To 6 ' choose 6 numbers
    Start: ' lets go (again)
    Randomize ' random-seed the random generator
    nLucky = Int((59 * Rnd) + 1) ' pick random number from 1 to 49
    For nCheck = 1 To 6
    If nLucky = Lottery(nCheck) Then ' if seleced number has already been picked...
    GoTo Start ' go back and pick another number.
    End If
    Next nCheck
    Lottery(nCount) = nLucky ' store selection in array
    Label1(nCount - 1) = Lottery(nCount) ' apply selection to labels (-1 for 0 to 5)
    Next nCount

    Thanks for the help.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I don't know this for a fact, as I've not worked with VB4 for quite a few years, but I suspect you aren't going to be able to use a database unless you can get your hands on an old copy of Access 95, or maybe Access 2.0

    Your best bet would probably be in saving your data to a text file.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width