Miguel,
I guess you are adding the control via tagPrefix. The markup code is compiled by ASP.NET separately on first access, this should be the cause of your problem.
I think if you add the control programmatically, then there won't be any problems.
However if you use an Application level variable rather than a static variable as I suggested earlier, it will work too for your case, see below:
If Application("Upload_Handler_Added") Is Nothing Then
AddHandler FileVistaControl.Uploaded, AddressOf FileVistaControl_Uploaded
Application("Upload_Handler_Added") = True
End If
Mauro,
I recommend you to use an online C# to VB convertor,
here is a good one. You can convert the example C# codes easily, it works pretty well.
See below for an example VB code for basic loading of the control:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim userName As String = "some user"
Dim userFolderName As String = "Folder of " & userName
Dim userFolderPath As String = "c:\user folders\" & userName
Dim fileVistaControl As FileVistaControl = DirectCast(LoadControl("~/FileVistaControl/filevista.ascx"), FileVistaControl)
Dim rootFolder As FileVistaRootFolder
rootFolder = New FileVistaRootFolder(userFolderName, userFolderPath)
rootFolder.Permissions = FileVistaPermissions.Traverse Or FileVistaPermissions.List Or FileVistaPermissions.Download
fileVistaControl.RootFolders.Add(rootFolder)
PlaceHolder1.Controls.Add(fileVistaControl)
End Sub