I want to create a bar chart using fusionchart, and get the data from database
This is my UI, if I click this link will go to the chart page
FRONT CODE FOR UI PAGE (Statistics.aspx)
<form id="form_statistics" runat="server">
<div>
<label for="name"></label>
<asp:DropDownList ID="ddlGender" runat="server"></asp:DropDownList>
<asp:Button ID="BtnSearch" runat="server" Text="Search" />
<br/><br/>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
<asp:Repeater ID="repGender" runat="server">
<HeaderTemplate>
<table cellspacing="0" rules="all" border="1">
<tr>
<th>Gender</th>
<th>Total</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# Eval("GENDER")%>
</td>
<td style="text-align: center">
<a href='<%# "Chart.aspx?GENDER_ID=" & Eval("GENDER") & ""%>'> <%# Eval("TOTAL")%></a>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr style="font-weight: bold">
<td>Grand Total</td>
<td style="text-align: center">
<asp:Label runat="server" ID="lblTotal"></asp:Label>
</td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
BEHIND CODE Statistics.aspx
Imports System.Data.SqlClient
Imports System.IO
Imports WebUserCtrl
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports FusionCharts.Charts
Imports System.Reflection
Partial Class Statistics
Inherits App.Main
Dim MyTotal As Integer
Dim MethodBase As Object
Private Property Label As Object
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
BindData()
ddlGender_Bind()
End If
End Sub
Sub BindData()
Dim dal As New DBWrapper.DAL(strConnectionString, strProviderName)
Dim dt As New DataTable
dal.DB.Parameters.Clear()
dal.DB.AddParameter("#GENDER", ddlGender.SelectedValue)
If dal.DB.ExecuteProcedure(dt, "GENDER_BB") Then
repGender.DataSource = dt
repGender.DataBind()
End If
End Sub
Protected Sub repGender_ItemCommand(source As Object, e As RepeaterCommandEventArgs) Handles repGender.ItemCommand
Dim dal As New DBWrapper.DAL(strConnectionString, strProviderName)
Dim dt As New DataTable
End Sub
Protected Sub repGender_ItemDataBound(sender As Object, e As RepeaterItemEventArgs) Handles repGender.ItemDataBound
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
Dim gData As DataRowView = e.Item.DataItem
MyTotal = MyTotal + gData.Item("TOTAL")
End If
If e.Item.ItemType = ListItemType.Footer Then
' set the total value in footer
Dim lblTotal As Label = e.Item.FindControl("lblTotal")
lblTotal.Text = MyTotal
End If
End Sub
Public Sub ddlGender_Bind()
Dim dal As New DBWrapper.DAL(strConnectionString, strProviderName)
Dim dt As New DataTable
If dal.DB.ExecuteProcedure(dt, "GENDER_R") Then
Share.LoadList(ddlGender, "GENDER", "GENDER_ID", dt, Enums.MsgCode.PleaseSelect.ToString, ListOrder.ByValue)
End If
End Sub
Protected Sub BtnSearch_Click(sender As Object, e As EventArgs) Handles BtnSearch.Click
Dim dal As New DBWrapper.DAL(strConnectionString, strProviderName)
Dim dt As New DataTable
dal.DB.Parameters.Clear()
dal.DB.AddParameter("#GENDER", ddlGender.SelectedValue)
If dal.DB.ExecuteProcedure(dt, "GENDER_B") Then
repGender.DataSource = dt
repGender.DataBind()
End If
End Sub
End Class
FRONT CODE FOR Chart.aspx
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Chart.aspx.vb" Inherits="Chart" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<!-- Include jQuery -->
<script type="text/javascript" src=" https://code.jquery.com/jquery-3.3.1.min.js"></script>
<!-- Include fusioncharts core library file -->
<script type="text/javascript" src=" https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js"></script>
<!-- Include fusion theme file -->
<script type="text/javascript" src=" https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js"></script>
<!-- Include fusioncharts jquery plugin -->
<script type="text/javascript" src=" https://rawgit.com/fusioncharts/fusioncharts-jquery-plugin/develop/dist/fusioncharts.jqueryplugin.min.js"></script>
<title>Chart</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</div>
</form>
</body>
</html>
BEHIND CODE Chart.aspx
Imports System.Data.SqlClient
Imports System.IO
Imports WebUserCtrl
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports FusionCharts.Charts
Imports System.Reflection
Partial Class Chart
Inherits App.Main
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
If Not IsPostBack Then
CreateChart()
End If
End Sub
Sub CreateChart()
Dim dal As New DBWrapper.DAL(strConnectionString, strProviderName)
Dim dt As New DataTable
Dim jsonData As New StringBuilder()
Dim ReqComma As Boolean = False
jsonData.Append("{'chart': {")
jsonData.Append("'caption': 'Chart',")
jsonData.Append("'yAxisName': 'Number',")
jsonData.Append("'theme': 'fusion'")
jsonData.Append("},")
jsonData.Append("'data' : [")
For Each dr As DataRow In dt.Rows
If ReqComma Then
jsonData.Append(",")
Else
ReqComma = True
End If
jsonData.Append("{" + "'label': '" & Replace(dr("GENDER"), "'", "\'") & "', 'value': '" & dr("TOTAL") & "'" + "}")
Next
jsonData.Append("]")
jsonData.Append("}")
Dim ChartOutput As New FusionCharts.Charts.Chart("column2d", MethodBase.GetCurrentMethod().Name, "100%", "300", "json", jsonData.ToString())
Literal1.Text = ChartOutput.Render()
End Sub
End Class
I can go to the other page(Chart.aspx) but I did not get the output, the data is not display. I am not sure where should I put the
Sub CreateChart()
Dim dal As New DBWrapper.DAL(strConnectionString, strProviderName)
Dim dt As New DataTable
Dim jsonData As New StringBuilder()
Dim ReqComma As Boolean = False
jsonData.Append("{'chart': {")
jsonData.Append("'caption': 'Chart',")
jsonData.Append("'yAxisName': 'Number',")
jsonData.Append("'theme': 'fusion'")
jsonData.Append("},")
jsonData.Append("'data' : [")
For Each dr As DataRow In dt.Rows
If ReqComma Then
jsonData.Append(",")
Else
ReqComma = True
End If
jsonData.Append("{" + "'label': '" & Replace(dr("GENDER"), "'", "\'") & "', 'value': '" & dr("TOTAL") & "'" + "}")
Next
jsonData.Append("]")
jsonData.Append("}")
Dim ChartOutput As New FusionCharts.Charts.Chart("column2d", MethodBase.GetCurrentMethod().Name, "100%", "300", "json", jsonData.ToString())
Literal1.Text = ChartOutput.Render()
End Sub
It is either at behind code at Statistics.aspx or Chart.aspx. Please help me, I am new with vb.net
Related
I have followed some of the instructions to create a new LinkButton at runtime with an event trigger and add an event handler for the LinkButton generated. I have no idea why the new LinkButton does not trigger the event added to it. Anyone please guide/correct me.
This is what I have right now.
ASPX:
<form id="myForm" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table class="mel-table" style="text-align: center" runat="server" id="mytab1">
<tbody>
<tr>
<td>Case Number :</td>
<td>
<asp:TextBox ID="caseNumber" runat="server"></asp:TextBox>
</td>
</tr>
</tbody>
</table>
<asp:Button OnClick="btnOK1_Click" ID="btnOK1" runat="server" Text="Save" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
ASPX.VB:
Protected Overloads Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("tablecontent") IsNot Nothing Then
mytab1 = CType(Session("tablecontent"), HtmlTable)
End If
End Sub
Public Function checking() As Boolean
Dim caseNo As Double
Try
caseNo = Convert.ToDouble((caseNumber.Text).Trim())
Catch ex As Exception
caseNo = 0
End Try
Dim r As New HtmlTableRow
Dim c0 As New HtmlTableCell
r.Cells.Add(c0)
Dim but As New LinkButton
but.ID = caseNo
but.Text = caseNo.ToString()
AddHandler but.Click, AddressOf LinkButton1_Click
c0.Controls.Add(but)
mytab1.Rows.Add(r)
Session("tablecontent") = mytab1
Return True
End Function
Protected Sub LinkButton1_Click(sender As Object, e As EventArgs)
'My Code here
End Sub
Protected Sub btnOK1_Click(sender As Object, e As EventArgs)
If (checking()) Then
ScriptManager.RegisterStartupScript(Page, Page.GetType, "Alert", "<script type='text/javascript'>alert('Success');</script>", False)
End If
End Sub
When you click on the "Save" button, save the data in either local storage or database and try to load the page again to fill the page with the content from the storage. In this case, you can have the content on the page and so, you can utilize the events also.
Whenever you create dynamic control you have to reload it on postback. I am using method call ReloadRows() for reloading added case which i am saving in ViewState:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional" >
<ContentTemplate>
<asp:Table class="mel-table" style="text-align: center" runat="server" id="mytab1">
<asp:TableRow>
<asp:TableCell>Case Number :</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="caseNumber" runat="server"></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Button OnClick="btnOK1_Click" ID="btnOK1" runat="server" Text="Save" />
</ContentTemplate>
</asp:UpdatePanel>
--------------------------------------------------------------------------------------------------------
Public Partial Class _Default
Inherits System.Web.UI.Page
Private listCaseNo As List(Of Double) = Nothing
Protected Sub Page_Init(sender As Object, e As EventArgs)
End Sub
Protected Sub Page_Load(sender As Object, e As EventArgs)
If ViewState("ListCases") IsNot Nothing Then
listCaseNo = DirectCast(ViewState("ListCases"), List(Of Double))
Else
listCaseNo = New List(Of Double)()
End If
ReloadRows()
End Sub
Public Function checking() As Boolean
Dim caseNo As Double = 0
Try
caseNo = Convert.ToDouble((caseNumber.Text).Trim())
Catch ex As Exception
caseNo = 0
End Try
Dim r As New TableRow()
Dim c0 As New TableCell()
r.Cells.Add(c0)
Dim but As New LinkButton()
but.ID = Convert.ToString(caseNo)
but.Text = caseNo.ToString()
AddHandler but.Click, AddressOf LinkButton1_Click
c0.Controls.Add(but)
mytab1.Rows.Add(r)
listCaseNo.Add(caseNo)
ViewState("ListCases") = listCaseNo
Return True
End Function
Private Sub ReloadRows()
For Each objCase As var In listCaseNo
Dim r As New TableRow()
Dim c0 As New TableCell()
r.Cells.Add(c0)
Dim but As New LinkButton()
but.ID = Convert.ToString(objCase)
but.Text = objCase.ToString()
AddHandler but.Click, AddressOf LinkButton1_Click
c0.Controls.Add(but)
mytab1.Rows.Add(r)
Next
End Sub
Protected Sub LinkButton1_Click(sender As Object, e As EventArgs)
'My Code here
End Sub
Protected Sub btnOK1_Click(sender As Object, e As EventArgs)
If (checking()) Then
End If
End Sub
End Class
I have found this code and I slightly re-writte it. I want that when I select order value from dropdown list, is showing customer in text below.
I have to say, that I have very little VB programming experience, so I'm stuck here.
Code:
<%# Page Language="VB" Debug="True" Strict="True" %>
<%# Import Namespace="System.Data.Odbc" %>
<%# Import Namespace="System.Data" %>
<%# import Namespace="System.Data.SqlClient" %>
<font face="calibri">
<script runat="server">
Dim connStr As String = "server=MSSQLEXP;database=ppwin1;Uid=sa_ro;pwd=sa_ro"
Sub Userlist_Init(ByVal Sender As Object, ByVal E As EventArgs)
Dim conn As New SqlConnection(connStr)
conn.Open()
Dim sql_user As String
Dim cmd_user As Sqlcommand
sql_User = "SELECT DISTINCT order, customer FROM dbo.T_CUSTOMER ORDER BY order ASC"
cmd_user = New Sqlcommand (sql_user, conn)
finduser.Datasource=cmd_user.ExecuteReader()
finduser.datatextfield = "customer"
finduser.databind()
conn.Close()
End Sub
Sub Finduser_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
txtuser.text = finduser.selecteditem.text
End sub
</script>
<html><head><title>Dropdown list from MS SQL DB</title></head>
<body><h1>Dropdown list from MS SQL DB</h1>
<br>
<form runat="server">
<asp:DropDownList ID="finduser" runat="server" AutoPostBack = "true" OnSelectedIndexChanged="Finduser_SelectedIndexChanged" OnInit="userlist_Init">
</asp:DropDownList>
<asp:Label id="txtuser" runat="server" />
</form>
</body>
</html>
Rok
Instead of this
finduser.Datasource = cmd_user.ExecuteReader()
finduser.datatextfield = "customer"
finduser.databind()
Did you tried this?
Dim dr As SqlClient.SqlDataReader = cmd_user.ExecuteReader
finduser.Items.Clear()
While dr.Read()
finduser.Items.Add(new ListItem(dr("customer"),dr("order"))
End While
OR
Dim dr As SqlClient.SqlDataReader
dr = cmd_user.ExecuteReader
Dim myData as New DataTable
If dr.HasRows Then
myData.Load(dr)
End If
ddldept.datasource = myData
ddldept.DataTextField = "customer"
ddldept.DataValueField = "order"
ddldept.DataBind()
i want to upload an image to a folder which is in my website's folder and then save it's path to database and display the uploaded image in control image.
when i executed my page the image is uploaded succefully and it's saved to database but it dosent displayed on the image control.
this is my view :
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!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>
</div>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" />
<asp:Image ID="Image1" runat="server" Height="91px" Width="145px" />
</form>
<p>
</p>
</body>
</html>
and this is my code :
Imports System.Data.SqlClient
Imports System.IO
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Dim cn As SqlConnection
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If FileUpload1.PostedFile IsNot Nothing Then
Dim FileName As String = Path.GetFileName(FileUpload1.PostedFile.FileName)
'Save files to disk
FileUpload1.SaveAs(Server.MapPath("~/im/" & FileName))
'Add Entry to DataBase
Dim strQuery As String = "insert into dbo.images" & " values(#FileName, #FilePath)"
Dim cmd As New SqlCommand(strQuery)
cmd.Parameters.AddWithValue("#FileName", FileName)
cmd.Parameters.AddWithValue("#FilePath", "~/im/" & FileName)
cmd.CommandType = CommandType.Text
cmd.Connection = cn
Try
cn.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
Response.Write(ex.Message)
Finally
cn.Close()
cn.Dispose()
End Try
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
cn = New SqlConnection("server=SEVO-PC;initial catalog=controle;integrated security=true")
End Sub
Protected Sub FileUpload1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles FileUpload1.Load
Image1.ImageUrl = "im/" & FileUpload1.FileName
End Sub
End Class
Try the following edit
Protected Sub FileUpload1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles FileUpload1.Load
Image1.ImageUrl = Server.MapPath("/im/") & FileUpload1.FileName
End Sub
I have a simple web application that is reading records from a CSV file and storing them in a database table. Then I am using SqlBulkCopy to copy the records into an SQL database using batches. All is fine with the insert. I am trying to give the user some feedback using OnSqlRowsCopied and NotifyAfter. The goal is to update a label that is contained in an UpdatePanel to display the number of records copied at the current NotifyAfter interval. However, the label will not update until SqlBulkCopy has complete. I can see that the s_OnSqlRowsCopied event is firing using Debug.WriteLine. What is the reason why the label won't update and how can I overcome this?
Code Behind
Imports System.Data.SqlClient
Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Dim filePath As String
Dim rowsCopied As String
Public Sub btnGetCSV_Click(sender As Object, e As EventArgs) Handles btnGetCSV.Click
filePath = System.IO.Path.GetFullPath(fileUpload1.PostedFile.FileName)
lblInfo.Text = filePath
End Sub
Protected Sub btnToSQL_Click(sender As Object, e As EventArgs) Handles btnToSQL.Click
Dim cs As String = System.Web.Configuration.WebConfigurationManager.ConnectionStrings("csMediaPortal").ConnectionString
CopyData(CSVtoDataTable(lblInfo.Text.ToString()), cs)
End Sub
Private Function CSVtoDataTable(filePath As String) As DataTable
Dim dt As DataTable = Nothing
Dim sourcePath As String = String.Empty
Dim csvFile As String = String.Empty
Dim conString As String = String.Empty
Dim conn As OleDb.OleDbConnection = Nothing
Dim adapter As OleDb.OleDbDataAdapter = Nothing
Dim selString As String = String.Empty
Try
sourcePath = System.IO.Path.GetDirectoryName(filePath)
csvFile = System.IO.Path.GetFileName(filePath)
conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sourcePath & ";Extended Properties=""text;HDR=No;FMT=FixedLength"""
conn = New OleDb.OleDbConnection(conString)
selString = "Select * From " & csvFile
adapter = New OleDb.OleDbDataAdapter(selString, conn)
dt = New DataTable(System.IO.Path.GetFileNameWithoutExtension(filePath))
conn.Open()
adapter.Fill(dt)
conn.Close()
Catch ex As Exception
lblInfo.Text = ex.Message
Finally
adapter.Dispose()
conn.Dispose()
End Try
Return dt
End Function
Protected Sub CopyData(sourceTable As DataTable, cs As String)
Using s As SqlBulkCopy = New SqlBulkCopy(cs, SqlBulkCopyOptions.UseInternalTransaction)
s.DestinationTableName = "test"
s.BatchSize = 1000
Try
AddHandler s.SqlRowsCopied, AddressOf s_OnSqlRowsCopied
s.NotifyAfter = 900
s.WriteToServer(sourceTable)
Catch ex As Exception
DirectCast(DirectCast(HttpContext.Current.Handler, Page).FindControl("lblInfo"), Label).Text = "Commit Error: " & ex.Message
End Try
s.Close()
End Using
End Sub
Protected Sub s_OnSqlRowsCopied(sender As Object, e As SqlRowsCopiedEventArgs)
Me.lblProgress.Value = e.RowsCopied.ToString()
Me.UpdatePanel1.Update()
Debug.WriteLine(e.RowsCopied)
End Sub
End Class
Web Form
<%# Page Language="vb" CodeBehind="WebForm1.aspx.vb" Inherits="CSVUpload.WebForm1" %>
<!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">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:FileUpload ID="fileUpload1" runat="server" />
<asp:Button ID="btnGetCSV" runat="server" Text="Post" OnClick="btnGetCSV_Click" />
<asp:Label ID="lblInfo" runat="server" Text="Label"></asp:Label>
</div>
<asp:Button ID="btnToSQL" runat="server" Text="Insert To SQL" OnClick="btnToSQL_Click" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<input runat="server" type="text" id="lblProgress" value="0" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
Imports System
Imports System.IO
Imports System.Linq
Namespace PhotoGalleryApp
Partial Public Class Index
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Path to photos folder
Dim photosRelativePath = "~/photos/"
Dim photosFilePath = Me.Server.MapPath(photosRelativePath)
' Get list of img files from photos folder
Dim photos = From file In New DirectoryInf(photosFilePath).GetFiles()
Where (file.Name.EndsWith(".jpg",
StringComparison.InvariantCultureIgnoreCase)
OrElse file.Name.EndsWith(".gif",
StringComparison.InvariantCultureIgnoreCase)
OrElse file.Name.EndsWith(".png",
StringComparison.InvariantCultureIgnoreCase))
Select photosRelativePath & file.Name
' Return photos as string array
lstPhotos.DataSource = photos.ToArray()
lstPhotos.DataBind()
End Sub
End Class
End Namespace
I am using this code for jQuery Cycle Plugin.
This is the aspx code
<asp:ListView ID="lstPhotos" runat="server">
<ItemTemplate>
<img src='<%# ResolveUrl(Container.DataItem.ToString()) %>' width="250" height="300" />
</ItemTemplate>
</asp:ListView>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.cycle/2.88/jquery.cycle.all.js"></script>
<script type="text/javascript">
$("#photos").cycle("toss");
</script>
I am setting the DataSource of the LIstView as Photos.ToArray() in the code behind..but still i get the error.. "Select DataSource for ListView"
Try replacing
Dim photos = From file In New DirectoryInfo(photosFilePath).GetFiles()
Where (file.Name.EndsWith(".jpg",
StringComparison.InvariantCultureIgnoreCase)
OrElse
file.Name.EndsWith(".gif",
StringComparison.InvariantCultureIgnoreCase) OrElse
file.Name.EndsWith(".png",
StringComparison.InvariantCultureIgnoreCase))
photosRelativePath & file.Name
with
Dim photos = From file In New DirectoryInfo(photosFilePath).GetFiles()
Where (file.Name.EndsWith(".jpg",
StringComparison.InvariantCultureIgnoreCase) OrElse
file.Name.EndsWith(".gif",
StringComparison.InvariantCultureIgnoreCase) OrElse
file.Name.EndsWith(".png",
StringComparison.InvariantCultureIgnoreCase))
select photosRelativePath & file.Name