# Visual Basic > Games and Graphics Programming > Game Demos >  VB6 Yahtzee!

## Cruncher

O.K I am finally done this game it took me a long time because i had lots of bugs when trying to make the highscore table to save scores, i was initially using a text file but it didn't work the way i wanted it to, so i was reading my school text book and it was talking about using an MS Access database to store information

anyway here it is, if anyone finds any bugs or any problems please let me know, and if anyone who does not have MS Access preferably not microsoft office at all could test this so i know the person doesn't need MS Access to use this method 

THANKS

Cruncher

\/ here it is \/

----------


## si_the_geek

Access is not needed - but as you have used data controls (rather than ADO code, which would have taken about the same amount of effort) your installation could be quite hard.  I'd recommend taking a look at the "ADO Tutorial" link in my signature to see how to use the code version.


Note that there is no need for the highlighted parts of this code (removing them will make no difference to the behaviour):


```
Private Sub cmdRoll_Click()
    roll = roll + 1
Beg:
    For i = 0 To 4
        If chk(i).value = 1 Then
            GoTo Endd
        ElseIf chk(i).value = 0 Then
            value(i) = RandDie
            imgDice(i).Picture = LoadPicture(App.Path & "\images\Dice50" & value(i) & ".gif")
            infoSwitch(i).Caption = value(i)
        End If
Endd:
    Next
```

----------


## Cruncher

i have a question for you si, i dont feel like reading tutorials tonight but uhh, a couple of people i sent this to said that when they run the exe they get something like this:

MSADODC.OSX couldnt be found or is not properly registered

i dont remember exact wording but it was something similar to that,

do you know why this is?

----------


## technorobbo

Since I have vb5 I substituted the data control with the missing OCX and got it to play just fine. Nice Job never played Yatzee before took me a while but I got the hang of it.

----------


## si_the_geek

When you distribute your program (whether compiled to Exe, or as the code files), you should include a setup package to install the required dependencies - which includes OCX's etc.

If you don't add any Components or References to your project, you might get lucky - as many people have the _basic_ VB6 dependencies (known as the runtimes).  This is the case if they have Vista or XP, or they have installed a VB6 program on their computer before.

By using a Data Control, the installation process is a bit harder - as it has various extra files that it depends on.  If you had used ADO Code instead, the process would have been simpler, as it doesn't have that issue (the dependencies for it are in a single package), and is also pre-installed on XP/Vista.  As I said before, in terms of using it in your program the effort would be almost identical to what you had done (and converting to it now would be relatively simple).


There is a bit more info about this kind of thing in the article Why doesn't my program work on another computer? from our Classic VB FAQs _(in the FAQ forum, which is shown near the top of our home page)_, and lots of extra details in our Application Deployment FAQ.

----------


## Cruncher

thanks, robbo helped me a lil bit on pm, but i was wondering about the package and deploy, i tried it but the setup doesnt create the subdirectories, it only creates the .exe so the program doesnt run, anyway to get it to make sub directories and put the pictures in it?

----------


## si_the_geek

I can't help with P&DW, I haven't used it in years (due to the poor quality and lack of features, I've used others instead).


How many pictures are there?

If there are only a few (I vaguely remember about 10), the simplest solution would be to not have them as separate files - but include them directly in the application, by adding them to PictureBoxes/Image controls (which don't need to be visible).  You can then use code like this to load them:


```
            Set imgDice(i).Picture = imgHidden(i).Picture
```

Not only will that simplify the deployment, but also make the loading them faster.

----------


## Cruncher

yeah i used to do that, but somehow i got the impression using app.path was better :S lol, oh well

thanks ill do that but there is still the problem that i use a database file which is app.path\appdata\hs.mdb

i doubt there is a way to put that into a project because it would erase to default properties after the program terminates... so either way i need to know how to install subdir's

----------


## Cruncher

btw the program doesnt even use whats in the original folders thats for my use, i should prolly take it out of that folder

----------


## si_the_geek

> thanks ill do that but there is still the problem that i use a database file which is app.path\appdata\hs.mdb


That is a problem, because even if you manage to install it as you want, it won't work as you intended - because the Program Files folder is not the place to store data files.

Many users will not have permission to edit it (thus you get errors), and for Vista (or later) if you have multiple users they will not see the same database file.

You should be storing data files in one of the AppData folders, which are designed for this purpose, and do not have those problems.  The folders are:
AppData_Local - for the current Windows user, on this computer onlyAppData - for the current Windows user, on any computer on the networkCommonAppData - for all Windows users on this computerYou can detect the location of these folders using API calls, as shown in the example (wrapped into a function) here.  Note that it doesn't include AppData_Local, but you can add it by adding this to the Enum: _feUserAppDataLocal = 28_

If you use that, the location of the file would be like this:


```
SpecialFolder(feUserAppData) & "\YourAppName\hs.mdb"
```

Most installation programs will allow you to install programs to the AppData folders easily, but I don't know how to do that with P&DW (the help may tell you).

----------


## Cruncher

to be honest when i used package and deploy it didnt seem very good:S do you know of any better ones? maybe its better if i create one myself? i would assume it cant be that difficult, it just wouldnt look as good.

----------


## si_the_geek

It would be extremely difficult to make one yourself, even experts have problems doing it properly (and they don't use VB to do it - as you need to install something _before_ the VB program can run!).

There are links to downloads and documentation for equivalent programs in our Application Deployment FAQ.

I personally prefer the Visual Studio Installer, which I think is on the VB CD.. and should be on microsoft.com/downloads

----------

