# Solved: Loading SWF from FileListBox (Visual Basic 6)



## lolerguy (Dec 25, 2008)

Hey guys 

Im working on a Flash program where you can load SWF files into a shockwaveflash object by clicking on it from the FileListBox. I use this code to make it load the SWF from FileListBox:


```
ShockwaveFlash1.Movie = File1.Selected As ShockwaveFlashObjectsCtl
```
Everytime i have typed this code in, it gives me this error:
Compile error:
Error: Expected end of statement

Am i completely wrong with this code, or is it just a minor prob?


----------



## -Fabez- (Jul 28, 2008)

Is there a reason you are using Visual Basic 6? It is outdated, meaning that using a newer version may give you better results. As for the code you provided, try removing


```
As ShockwaveFlashObjectsCtl
```
and see if that works.


----------



## lolerguy (Dec 25, 2008)

It somehow worked, but when i then compile it to some .exe then it gives me this error:

Compile error:
Argument not optional

How do i solve this?


----------



## -Fabez- (Jul 28, 2008)

Is there a reason you are using an outdated version of Visual Basic ? Can you post the arguments intelliSense asks for ?


----------



## lolerguy (Dec 25, 2008)

Well, i just feel more "comfortable" with the older version of VB as it was the first program that i learned to code with. I havent used the newer ones that much, even tho i have VB Express 2008 on my PC. Should i use that one instead?


----------



## -Fabez- (Jul 28, 2008)

As Visual Basic 2008 is the newest version of the language, it is best to use it, although you can use Visual Basic 6 if you want. The advantage of using Visual Basic 2008 is that it has more documentation available and has better support. For example this code will load a .Swf into a Adobe Flash Player object in Visual Basic 2008. The path to the .Swf could be identified using many components.


```
Public Class Main
    Private Sub Main_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        FlashHolder.LoadMovie(0, "[I]Absolute Path[/I]\Test.swf")
    End Sub
End Class
```


----------



## lolerguy (Dec 25, 2008)

Ahh i see 

I have moved to VB Express 2008 now, and the code is working perfect.

Thanks for your effort


----------



## -Fabez- (Jul 28, 2008)

Glad you got it working


----------

