1
Vote

VB

description

First of all, thank you so much for this wonderful solution. However, I have an issue translating this to VB. The test in C# works but if I copy the code for the aspx. page (copy and paste) and translate (using developer fusion utility) the aspx..cs the player does not show up.

Any help would very appreciated.
Here is the vb ode
Imports System


Partial Public Class Default2
Inherits System.Web.UI.Page

Region "init settings"

' player width
Private _W As Integer = 640

' player height
Private _H As Integer = 505

' autoplay disabled
Private auto As Boolean = False

End Region

Region "Page Load event"

Protected Sub Page_Load(sender As Object, e As EventArgs)

    If Not IsPostBack Then
        '#Region "Start mode customization via Web Query String"
        Dim idx As Integer = 0
        Dim qry As String = ""

        ' Web Query to set autoplay option
        Try
            qry = "auto"
            qry = If((Request.QueryString(qry) Is Nothing), "", Request.QueryString(qry))
            If qry <> "" Then
                auto = [Boolean].Parse(qry)
            End If
        Catch
        End Try

        ' Web Query to set item index
        Try
            qry = "item"
            qry = If((Request.QueryString(qry) Is Nothing), "", Request.QueryString(qry))
            If qry <> "" Then
                idx = Integer.Parse(qry)
            End If
        Catch
        End Try
        '#End Region

        ' set selected index
        cmbPlaylist.SelectedIndex = idx

        ' generate script on page load
        Literal1.Text = YouTubeScript.[Get](cmbPlaylist.SelectedValue, auto, _W, _H)
    Else
        ' generate script on page postback
        Literal1.Text = YouTubeScript.[Get](cmbPlaylist.SelectedValue, False, _W, _H)
    End If
End Sub

End Region

Region "User events"

''' <summary>
''' Script to start video at predefined time, change border color
''' </summary>
Protected Sub Button1_Click(sender As Object, e As EventArgs)
    ' set start time = 15 sec, change border colors
    Literal1.Text = YouTubeScript.[Get](cmbPlaylist.SelectedValue, True, _W, _H, True, "maroon", _
        "", 15)
End Sub

''' <summary>
''' Script to start video at predefined time, remove border
''' </summary>
Protected Sub Button2_Click(sender As Object, e As EventArgs)
    ' set start time = 60 sec, remove border
    Literal1.Text = YouTubeScript.[Get](cmbPlaylist.SelectedValue, True, _W, _H, False, "", _
        "", 60)
End Sub

End Region

End Class

comments