flickr.PhotosetsGetPhotos problem

Topics: Developer Forum
Sep 19, 2010 at 1:25 PM

Hi,

I am trying to get photo's from a flickr set in asp.net vb but i get an error :  " Value of type 'FlickrNet.PhotosetPhotoCollection' cannot be converted to '1-dimensional array of FlickrNet.Photo " (3.1b2)
can someone help me out ?
thanks !

code:

Imports FlickrNet
Partial Class getphotofromset
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim ApiKey = "myapikey"
        Dim SharedSecret = "mysharedsecret"
        Dim AuthToken = "myauthtoken"

        Dim flickr As New Flickr(ApiKey, SharedSecret, AuthToken) 

        Dim photos As Photo() = flickr.PhotosetsGetPhotos("72157624894734736") '<-  Value of type 'FlickrNet.PhotosetPhotoCollection' cannot be converted to '1-dimensional array of FlickrNet.Photo

        rptPhotos.DataSource = photos
        rptPhotos.DataBind()

    End Sub
End Class

 

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="getphoto.aspx.vb" Inherits="getphotofromset" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <ASP:LABEL id=lblAlbumTitle runat="server"></ASP:LABEL>
<BR>
<ASP:LABEL id=lblAlbumDescription runat="server"></ASP:LABEL>
<BR><BR>
<ASP:REPEATER id=rptPhotos runat="server">        
 <ITEMTEMPLATE>
     <ASP:IMAGEBUTTON id=imgPhoto runat="server" ImageUrl='<%# Eval("ThumbnailUrl") %>' ToolTip='<%# Eval("Title") %>'></ASP:IMAGEBUTTON>
 </ITEMTEMPLATE>

</ASP:REPEATER>
    </div>
    </form>
</body>
</html>

 

 

Sep 30, 2010 at 8:20 AM

nobody ?

Coordinator
Oct 1, 2010 at 5:52 PM
Just do this instead:

Dim photos As PhotosetPhotoCollection =
flickr.PhotosetsGetPhotos("72157624894734736")

The PhotosetPhotoCollection class inherits from Collection(Of Photo)
so can be used directly for data binding or looping in a For Each
statement without needing to convert to an array of Photo instances.

Sam
Oct 1, 2010 at 6:23 PM
Thanks Sam ! I Will try.