Question about dynamic websites with .net

V

Vili

Hi all.

I am trying to create a dynamic website that has links to the files in a
specicif folder.
Files in the folder will be changing daily.

So far I have put a textbox to html and code in as such:

'
'This writes the amount of files to textbox
'
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim dirs As String() = Directory.GetFiles("C:\folder\files", "*")
Dim dir As String
Try
For Each dir In dirs
Console.WriteLine(dir)
Next
textbox.text = ("there is " & i & " items in the folder")
Catch virhe As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try
End Sub

Thing is that now I am jammed.

Tuomo
 
P

Piedro

JLW said:
What are you jammed on?
Hi if you are jammed on the above sample it's probably because you
haven't got your i declared, or don't do i +=1, if you've got another
problem please be a bit more specific.

Gr Peter
 
V

Vili

Piedro said:
"JLW" <[email protected]> wrote in message
Hi if you are jammed on the above sample it's probably because you
haven't got your i declared, or don't do i +=1, if you've got another
problem please be a bit more specific.

Gr Peter

Ok I wasnt so clear about my problem.
I have a folder where I have files.
I am trying to make a small script that displays the files to and html file
so that I could
<name of the file> <url to the file>

I have now realised that I have been trying to do this the wrong way.

So I switched to ASPX -file with VBScript and now I have gotten little
closer to solving this.

Tuomo

Ps. Piedro I sent this first only to you by mistake. Not meaning to spam :)
 
P

Piedro

Vili said:
Ok I wasnt so clear about my problem.
I have a folder where I have files.
I am trying to make a small script that displays the files to and html file
so that I could
<name of the file> <url to the file>

I have now realised that I have been trying to do this the wrong way.

So I switched to ASPX -file with VBScript and now I have gotten little
closer to solving this.

Tuomo

Ps. Piedro I sent this first only to you by mistake. Not meaning to spam :)

No problem Tuomo, we're all just human and can make a mistake. But
Tuomo first I've got a question for you, have you ever been to
Belgium? Because at my school in Geel we once had a guest speaker from
Finland and if I remember it well his name also was Tuomo Vili. Now
maybe this code can help you:
///
Dim strFile() As String
Dim x As Integer
strFile = System.IO.Directory.GetFiles("C:\folder\files" )

For x = 0 To strFile.GetUpperBound(0)

Dim flInfo As System.IO.FileInfo

Dim strName As String

flInfo = New System.IO.FileInfo(strFile(x))

strName = flInfo.Name 'gets only the filename
Debug.WriteLine(strFile(x)) 'gets the fully qualfied name
Debug.WriteLine(strName)

Next
///
but because you want it displayed in a html page, you'll have to add
something like this in the for loop:
response.write("Klik the file to go to the link:<a href='" &
strFile(x) & "'> " & strName & "</a>")

Hope this helps you sorry for the slow response, but I'm at my work.

Greetz Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top