|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
spaces in file pathsThe following doesn't work:
Dim photoPath As String =3D "R:\My Documents\My Pictures\MiscLL\" It doesn't work if I use double quotes either. It does work if I use a = = different path without spaces in it. What is the simple solution ? -- = Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ concatenate double quotes around it:
Dim photoPath As String = chr(34) + "R:\My Documents\My Pictures\MiscLL\" + chr(34) -- HTH Éric Moreau, MCSD, Visual Developer - Visual Basic MVP Conseiller Principal / Senior Consultant S2i web inc. (www.s2i.com) http://emoreau.s2i.com/ "DesCF" <de***@aol.com> wrote in message news:op.tkplbpvrupgxg0@descstar... The following doesn't work:Dim photoPath As String = "R:\My Documents\My Pictures\MiscLL\" It doesn't work if I use double quotes either. It does work if I use a different path without spaces in it. What is the simple solution ? I tried this and I get an invalid characters in path error. Thanks for =
= the suggestion anyrate. On Sun, 17 Dec 2006 16:18:30 -0000, Eric Moreau = <eric.moreau_N_O_S_P_***@videotron.ca> wrote: > concatenate double quotes around it: -- => > Dim photoPath As String =3D chr(34) + "R:\My Documents\My = > Pictures\MiscLL\" + > chr(34) > > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ What are you trying to do with it; how are you trying to use it?
Post more of your code, and maybe we can help you with it. Robin S. ------------------------------ "DesCF" <de***@aol.com> wrote in message news:op.tkptgf1aupgxg0@descstar...I tried this and I get an invalid characters in path error. Thanks for the suggestion anyrate. On Sun, 17 Dec 2006 16:18:30 -0000, Eric Moreau <eric.moreau_N_O_S_P_***@videotron.ca> wrote: > concatenate double quotes around it: > > Dim photoPath As String = chr(34) + "R:\My Documents\My > Pictures\MiscLL\" + > chr(34) > > I'd be shocked if that didn't work. It doesn't assign that string to the
photoPath variable? "DesCF" <de***@aol.com> wrote in message news:op.tkplbpvrupgxg0@descstar... The following doesn't work:Dim photoPath As String = "R:\My Documents\My Pictures\MiscLL\" It doesn't work if I use double quotes either. It does work if I use a different path without spaces in it. What is the simple solution ? Tom,
This is not in every country the same, here in Holland I have C:\Documents and Settings\cor\Mijn documenten\Mijn afbeeldingen I thought that Herfried had that Document and Settings in the German language as well. However this is as well working here. Environment.SpecialFolder.MyPictures I know that you knew this. :-) CorTherefore Environment. Show quoteHide quote "Tom Leylan" <tleylan@nospam.net> schreef in bericht news:Oo2qjefIHHA.4760@TK2MSFTNGP03.phx.gbl... > I'd be shocked if that didn't work. It doesn't assign that string to the > photoPath variable? > > "DesCF" <de***@aol.com> wrote in message > news:op.tkplbpvrupgxg0@descstar... > The following doesn't work: > > Dim photoPath As String = "R:\My Documents\My Pictures\MiscLL\" > > It doesn't work if I use double quotes either. It does work if I use a > different path without spaces in it. What is the simple solution ? > > > > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > Cor,
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb: It's "C:\Dokumente und Einstellungen\...\Eigene Dokumente\Eigene Bilder" on > This is not in every country the same, here in Holland I have > > C:\Documents and Settings\cor\Mijn documenten\Mijn afbeeldingen > > I thought that Herfried had that Document and Settings in the German > language as well. my German version of Windows XP. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> Hi Cor:
I don't believe the assignment of either string would fail in any country Show quoteHide quote :-) "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%23VGWiFhIHHA.1816@TK2MSFTNGP06.phx.gbl... > Tom, > > This is not in every country the same, here in Holland I have > > C:\Documents and Settings\cor\Mijn documenten\Mijn afbeeldingen > > I thought that Herfried had that Document and Settings in the German > language as well. > > However this is as well working here. > > Environment.SpecialFolder.MyPictures > > I know that you knew this. > > :-) > > Cor > > Therefore Environment. > "Tom Leylan" <tleylan@nospam.net> schreef in bericht > news:Oo2qjefIHHA.4760@TK2MSFTNGP03.phx.gbl... >> I'd be shocked if that didn't work. It doesn't assign that string to the >> photoPath variable? >> >> "DesCF" <de***@aol.com> wrote in message >> news:op.tkplbpvrupgxg0@descstar... >> The following doesn't work: >> >> Dim photoPath As String = "R:\My Documents\My Pictures\MiscLL\" >> >> It doesn't work if I use double quotes either. It does work if I use a >> different path without spaces in it. What is the simple solution ? >> >> >> >> -- >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ >> > > Tom,
I agree with you, however I saw nowhere in the answers the message to the Environment Special folder and thought as the OP has installed in a kind of crazy way to that R folder while also writing it in an easy way, than this could be the problem. It can of course as well be incorrect rights on that virtual folder as it is often. :-) CorShow quoteHide quote "Tom Leylan" <tleylan@nospam.net> schreef in bericht news:uRWvishIHHA.780@TK2MSFTNGP03.phx.gbl... > Hi Cor: > > I don't believe the assignment of either string would fail in any country > :-) > > > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message > news:%23VGWiFhIHHA.1816@TK2MSFTNGP06.phx.gbl... >> Tom, >> >> This is not in every country the same, here in Holland I have >> >> C:\Documents and Settings\cor\Mijn documenten\Mijn afbeeldingen >> >> I thought that Herfried had that Document and Settings in the German >> language as well. >> >> However this is as well working here. >> >> Environment.SpecialFolder.MyPictures >> >> I know that you knew this. >> >> :-) >> >> Cor >> >> Therefore Environment. >> "Tom Leylan" <tleylan@nospam.net> schreef in bericht >> news:Oo2qjefIHHA.4760@TK2MSFTNGP03.phx.gbl... >>> I'd be shocked if that didn't work. It doesn't assign that string to >>> the photoPath variable? >>> >>> "DesCF" <de***@aol.com> wrote in message >>> news:op.tkplbpvrupgxg0@descstar... >>> The following doesn't work: >>> >>> Dim photoPath As String = "R:\My Documents\My Pictures\MiscLL\" >>> >>> It doesn't work if I use double quotes either. It does work if I use a >>> different path without spaces in it. What is the simple solution ? >>> >>> >>> >>> -- >>> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ >>> >> >> > > "DesCF" <de***@aol.com> schrieb: What does not work?!>The following doesn't work: > >Dim photoPath As String = "R:\My Documents\My Pictures\MiscLL\" > >It doesn't work if I use double quotes either. It does work if I use a >different path without spaces in it. What is the simple solution ? -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> Herfried,
Sie auch, unglaublich? :-) CorShow quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schreef in bericht news:%23wdvglfIHHA.4992@TK2MSFTNGP04.phx.gbl... > "DesCF" <de***@aol.com> schrieb: >>The following doesn't work: >> >>Dim photoPath As String = "R:\My Documents\My Pictures\MiscLL\" >> >>It doesn't work if I use double quotes either. It does work if I use a >>different path without spaces in it. What is the simple solution ? > > What does not work?! > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://dotnet.mvps.org/dotnet/faqs/> Right, the code for the entire web page is below.
If I create a directory J:\Fots and stick some photos in it, it works ju= st = fine. If I change the directory name to J:\Fot s (i.e. insert a space = between the t and the s) it just displays the placeholders for the right= = number of photos with little red X's in them. <%@ Page Language=3D"VB" %> <%@ Import Namespace=3D"System.IO" %> <%@ Import Namespace=3D"System.Collections.Generic" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" = "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <script runat=3D"server"> ''' <summary> ''' Bind photos to Repeater ''' </summary> Sub Page_Load() If Not Page.IsPostBack Then Repeater1.DataSource =3D GetPhotos() Repeater1.DataBind() End If End Sub ''' <summary> ''' Get list of photos from Photo folder ''' </summary> Public Function GetPhotos() As List(Of String) Dim photos As New List(Of String)() Dim photoPath As String =3D "J:\Fot s\" Dim files As String() =3D Directory.GetFiles(photoPath) For Each photo As String In files photos.Add(photoPath + Path.GetFileName(photo)) Next Return photos End Function </script> <html xmlns=3D"http://www.w3.org/1999/xhtml" > <head id=3D"Head1" runat=3D"server"> <title>Show Photos</title> </head> <body> <form id=3D"form1" runat=3D"server"> <div> <asp:Repeater id=3D"Repeater1" runat=3D"server"> <ItemTemplate> <asp:Image id=3D"Image1" Width=3D"200px" ImageUrl=3D'<%# Container.DataItem %>' Runat=3D"server" /> </ItemTemplate> </asp:Repeater> </div> </form> </body> </html> --- On Sun, 17 Dec 2006 15:00:51 -0000, DesCF <de***@aol.com> wrote: > The following doesn't work: -- => > Dim photoPath As String =3D "R:\My Documents\My Pictures\MiscLL\" > > It doesn't work if I use double quotes either. It does work if I use = a = > different path without spaces in it. What is the simple solution ? > > > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ "When something doesn't seem to work correctly eliminate all the surrounding
code so you can concentrate on the one part that doesn't seem to work correctly." Did you try simply getting a directory and displaying the file names on your local drive? If so did it work? I think you will find that it does work whether or not there are spaces but you should confirm this. Now you know that isn't the problem after all and you can spend some time finding real problem. BTW isn't your line: photos.Add(photoPath + Path.GetFileName(photo)) the same as simply using the photo value? Aren't you stripping the path off and putting it back on? "DesCF" <de***@aol.com> wrote in message news:op.tkptcogqupgxg0@descstar... Right, the code for the entire web page is below.If I create a directory J:\Fots and stick some photos in it, it works just fine. If I change the directory name to J:\Fot s (i.e. insert a space between the t and the s) it just displays the placeholders for the right number of photos with little red X's in them. <%@ Page Language="VB" %> <%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Collections.Generic" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <script runat="server"> ''' <summary> ''' Bind photos to Repeater ''' </summary> Sub Page_Load() If Not Page.IsPostBack Then Repeater1.DataSource = GetPhotos() Repeater1.DataBind() End If End Sub ''' <summary> ''' Get list of photos from Photo folder ''' </summary> Public Function GetPhotos() As List(Of String) Dim photos As New List(Of String)() Dim photoPath As String = "J:\Fot s\" Dim files As String() = Directory.GetFiles(photoPath) For Each photo As String In files photos.Add(photoPath + Path.GetFileName(photo)) Next Return photos End Function </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>Show Photos</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <asp:Image id="Image1" Width="200px" ImageUrl='<%# Container.DataItem %>' Runat="server" /> </ItemTemplate> </asp:Repeater> </div> </form> </body> </html> --- On Sun, 17 Dec 2006 15:00:51 -0000, DesCF <de***@aol.com> wrote: > The following doesn't work: > > Dim photoPath As String = "R:\My Documents\My Pictures\MiscLL\" > > It doesn't work if I use double quotes either. It does work if I use a > different path without spaces in it. What is the simple solution ? > > > Tom,
Very good answer seen all others including mine :-) CorShow quoteHide quote "Tom Leylan" <tleylan@nospam.net> schreef in bericht news:e$7pW2iIHHA.1912@TK2MSFTNGP03.phx.gbl... > "When something doesn't seem to work correctly eliminate all the > surrounding code so you can concentrate on the one part that doesn't seem > to work correctly." > > Did you try simply getting a directory and displaying the file names on > your local drive? If so did it work? I think you will find that it does > work whether or not there are spaces but you should confirm this. Now you > know that isn't the problem after all and you can spend some time finding > real problem. > > BTW isn't your line: photos.Add(photoPath + Path.GetFileName(photo)) the > same as simply using the photo value? Aren't you stripping the path off > and putting it back on? > > > > "DesCF" <de***@aol.com> wrote in message > news:op.tkptcogqupgxg0@descstar... > Right, the code for the entire web page is below. > > If I create a directory J:\Fots and stick some photos in it, it works just > fine. If I change the directory name to J:\Fot s (i.e. insert a space > between the t and the s) it just displays the placeholders for the right > number of photos with little red X's in them. > > > <%@ Page Language="VB" %> > <%@ Import Namespace="System.IO" %> > <%@ Import Namespace="System.Collections.Generic" %> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> > <script runat="server"> > > ''' <summary> > ''' Bind photos to Repeater > ''' </summary> > Sub Page_Load() > If Not Page.IsPostBack Then > Repeater1.DataSource = GetPhotos() > Repeater1.DataBind() > End If > End Sub > > ''' <summary> > ''' Get list of photos from Photo folder > ''' </summary> > Public Function GetPhotos() As List(Of String) > Dim photos As New List(Of String)() > Dim photoPath As String = "J:\Fot s\" > Dim files As String() = Directory.GetFiles(photoPath) > For Each photo As String In files > photos.Add(photoPath + Path.GetFileName(photo)) > Next > Return photos > End Function > > </script> > <html xmlns="http://www.w3.org/1999/xhtml" > > <head id="Head1" runat="server"> > <title>Show Photos</title> > </head> > <body> > <form id="form1" runat="server"> > <div> > > <asp:Repeater > id="Repeater1" > runat="server"> > <ItemTemplate> > <asp:Image > id="Image1" > Width="200px" > ImageUrl='<%# Container.DataItem %>' > Runat="server" /> > </ItemTemplate> > </asp:Repeater> > > </div> > </form> > </body> > </html> > > > > --- > > > On Sun, 17 Dec 2006 15:00:51 -0000, DesCF <de***@aol.com> wrote: > >> The following doesn't work: >> >> Dim photoPath As String = "R:\My Documents\My Pictures\MiscLL\" >> >> It doesn't work if I use double quotes either. It does work if I use a >> different path without spaces in it. What is the simple solution ? >> >> >> > > > > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > DesCF wrote:
> Right, the code for the entire web page is below. Ahhhh, web page... URLs... no unencoded spaces allowed.> If I create a directory J:\Fots and stick some photos in it, it works If you want a space in a URL, change it to "%20" or "+" for the browser. See > just fine. If I change the directory name to J:\Fot s (i.e. insert a > space between the t and the s) it just displays the placeholders for > the right number of photos with little red X's in them. the UrlEncode function. A better option would be to not use spaces. Look at the generated URLs in the resultant web page and see what the browser is trying to ask for and also remember to look in the web server's logfile to see what was requested and why it could not be returned. Does that make sense? Andrew I have tried inserting %20 and + and I get back 'Could not find a part of
the path 'J:\Fot%20s'.' and 'Could not find a part of the path 'J:\Fot+s'.' respectively. I cannot find the UrlEncode function. The URL Address of an empty picture placeholder is: file:///J:/Fot%2520s/0001.jpg I do not know where to find the web servers log file. I am using Visual Web Developer and it creates a kind of pop-up web server on the fly. On Mon, 18 Dec 2006 13:53:11 -0000, Andrew Morton <a**@in-press.co.uk.invalid> wrote: Show quoteHide quote > DesCF wrote: >> Right, the code for the entire web page is below. > > Ahhhh, web page... URLs... no unencoded spaces allowed. > >> If I create a directory J:\Fots and stick some photos in it, it works >> just fine. If I change the directory name to J:\Fot s (i.e. insert a >> space between the t and the s) it just displays the placeholders for >> the right number of photos with little red X's in them. > > If you want a space in a URL, change it to "%20" or "+" for the browser. > See > the UrlEncode function. A better option would be to not use spaces. Look > at > the generated URLs in the resultant web page and see what the browser is > trying to ask for and also remember to look in the web server's logfile > to > see what was requested and why it could not be returned. > > Does that make sense? > > Andrew > > DesCF wrote:
> I have tried inserting %20 and + and I get back 'Could not find a Which program do those error messages come from?> part of the path 'J:\Fot%20s'.' and 'Could not find a part of the path > 'J:\Fot+s'.' respectively. > I cannot find the UrlEncode function. Are you saying that VWD comes without searchable help?System.Web.HttpServerUtility.UrlEncode > Is that when looking at the source in a browser? Because %25 is the encoding > The URL Address of an empty picture placeholder is: > file:///J:/Fot%2520s/0001.jpg for "%", so it looks like the URL encoding might have been done for you already. > I do not know where to find the web servers log file. I am using I see from the info about VWD that "Visual Web Developer includes the > Visual Web Developer and it creates a kind of pop-up web server on > the fly. ability to create your Web applications using a Web server, FTP site, or file share. File share-based Web sites are great for testing and don't require you to have IIS installed on your computer, making them a great solution on Windows XP Home Edition users." (source: http://msdn.microsoft.com/vstudio/express/vwd/features/deploy/default.aspx ). Apparently you have found a case where file share-based web sites are /not/ great for testing. Could you install IIS and use that, or are you on XP Home? Also, you could use FileMon (http://www.microsoft.com/technet/sysinternals/utilities/filemon.mspx) or its successor ProcessMonitor (http://www.microsoft.com/technet/sysinternals/processesandthreads/processmonitor.mspx) to see what file the browser is requesting. Or maybe you could just use paths and filenames without spaces? Andrew Des
if it is your own map, than it is mostly Environment.SpecialFolder.MyPictures Cor "DesCF" <de***@aol.com> schreef in bericht news:op.tkplbpvrupgxg0@descstar...The following doesn't work: Dim photoPath As String = "R:\My Documents\My Pictures\MiscLL\" It doesn't work if I use double quotes either. It does work if I use a different path without spaces in it. What is the simple solution ?
GOOD BOOKS OF VB2005
Setting focus to the Form Sending an XML Node to a Function for Processing SP1 Install - was it successful? Screen Scraping a Password Protected Site How to put shell output into a textbox Problem with datagridview menu Implement Icomparable Can't change RichTextBox Color Table. |
|||||||||||||||||||||||