Getting blanks in filenames to appear in dynamically built href's 
Author Message
 Getting blanks in filenames to appear in dynamically built href's

how do you accomplish dynamically building in VB.net a list of
href's that refer to filenames that may contain blanks? i.e., i want to
do:

dim dir as DirectoryInfo("C:\")
dim f as FileInfo
for each f in dir.GetFiles("*.pdf")
    dim name as [String] = f.name
    Response.Write("<p><a href=" & name & ">" & name & "</a></p>")
next f

But if a file "hello there.pdf" exists the href only refers to "hello", not
the full
string. I have tried replacing the spaces with "%20" [hexadecimal for a
blank]
but this didn't work, nor did various combinations of quotes,double quotes
etc.

anyone have any thoughts?
thx
j.



Wed, 17 Mar 2004 00:16:39 GMT  
 Getting blanks in filenames to appear in dynamically built href's
i have found a solution! Use

   & chr(34) & name & chr(34) &

and the problem is solved.


Quote:
> how do you accomplish dynamically building in VB.net a list of
> href's that refer to filenames that may contain blanks? i.e., i want to
> do:

> dim dir as DirectoryInfo("C:\")
> dim f as FileInfo
> for each f in dir.GetFiles("*.pdf")
>     dim name as [String] = f.name
>     Response.Write("<p><a href=" & name & ">" & name & "</a></p>")
> next f

> But if a file "hello there.pdf" exists the href only refers to "hello",
not
> the full
> string. I have tried replacing the spaces with "%20" [hexadecimal for a
> blank]
> but this didn't work, nor did various combinations of quotes,double quotes
> etc.

> anyone have any thoughts?
> thx
> j.



Wed, 17 Mar 2004 00:45:21 GMT  
 Getting blanks in filenames to appear in dynamically built href's
if you insert chr(34) around the name it works just fine,
thus

& chr(34) & name & chr(34) &



Wed, 17 Mar 2004 00:46:26 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. getting just the filename, not the filename path from the opendialog control

2. Combo box on fromHeader appears blank after requery

3. activex control w ssframe appears blank

4. Format for appears blank text

5. Help: Multiselect, filenames don't appear in FileName Property?

6. Help: multiselect, filenames in FIleName property don't appear?

7. Getting crazy with IE versions and location.href (HELP)

8. Introducing Visual Build, the developer's build utility for Windows

9. Introducing Visual Build, the developer's build utility for Windows

10. Form does not appear in Inheritance Picker even after build

11. Modify filename of picture in CR for .NET dynamically

12. Build a SQL statment dynamically

 

 
Powered by phpBB® Forum Software