Simple SWF Loader

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
7 posts Page 1 of 1
Contributors
User avatar
smashvb
Just Registered
Just Registered
Posts: 8
Joined: Thu Feb 03, 2011 9:43 am

Simple SWF Loader
smashvb
I have seen these around but I thought I would make a simple tutorial.

Add a panel and dock fill it Top
Put a textbox and a button inside.
Add a web browser and dock it to fill

First, Add this code to the button1.Click
Code: Select all
    If TextBox1.Text.Contains("swf") = True Then
        WebBrowser1.Navigate(TextBox1.Text)
        Else
            MsgBox("You can only load SWF Files!")
        End If
Next, lets make it so the Enter key will also load the SWF, click the Textbox and in the properties click the Event button scroll down to KeyUp and double click it.

Add this code:
Code: Select all
   If e.KeyCode = Keys.Enter Then
            If TextBox1.Text.Contains("swf") = True Then
                WebBrowser1.Navigate(TextBox1.Text)
            Else
                MsgBox("You can only load SWF files!")
            End If
        End If
Pretty simple :) tell me what you think
Last edited by smashvb on Sun Feb 06, 2011 9:43 am, edited 1 time in total.
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: Simple SWF Loader
MrAksel
I think its great for newbies, but there is other ways too. Like right clicking the toolbox, press 'Choose Items' And find a component named 'AxShockwaveFlash' or something like that.
And you forgot an end parentheses in the first code box:
Code: Select all
If TextBox1.Text.Contains("swf") = True Then
        WebBrowser1.Navigate(TextBox1.Text    '<-------- There it is
Else
        MsgBox("You can only load SWF Files!")
End If
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
smashvb
Just Registered
Just Registered
Posts: 8
Joined: Thu Feb 03, 2011 9:43 am

Re: Simple SWF Loader
smashvb
yeah I do know the Flash Component but I left it as a WebBrowser because then you make it so it loads web pages too if you wanted too
User avatar
MrAksel
C# Coder
C# Coder
Posts: 1758
Joined: Fri Mar 26, 2010 12:27 pm

Re: Simple SWF Loader
MrAksel
Yeah i know. But you should fix that code, else you will get many posts its not working
LMAOSHMSFOAIDMT
Laughing my a** of so hard my sombrero fell off and I dropped my taco lmao;


Over 30 projects with source code!
Please give reputation to helpful members!

Image
Image
User avatar
smashvb
Just Registered
Just Registered
Posts: 8
Joined: Thu Feb 03, 2011 9:43 am

Re: Simple SWF Loader
smashvb
Fixed thanks didn't see that
User avatar
Axel
Coding God
Coding God
Posts: 1928
Joined: Sun Jun 27, 2010 9:15 pm

Re: Simple SWF Loader
Axel
I think it would be better if you used endswith , there might be a website called "www.swfthings.com"

so
Code: Select all
If TextBox1.Text.endswith(".swf") Then
'true' isn't needed
http://vagex.com/?ref=25000
User avatar
smashvb
Just Registered
Just Registered
Posts: 8
Joined: Thu Feb 03, 2011 9:43 am

Re: Simple SWF Loader
smashvb
Pretty new to VB, thanks :)
7 posts Page 1 of 1
Return to “Tutorials”