|
-
Jun 11th, 2007, 05:24 AM
#1
Thread Starter
Lively Member
[RESOLVED] [2005] Opening a file in a webpage
I want to know how to open a file using VB in a webpage.
I've created a webpage in Visual Studios 2005 with a treeview. When a user clicks a node of the treeview I want an excel file to open, (in excel).
How do I do this?
When the user selects a treenode the following code runs:
Code:
Sub Select_Change(ByVal sender As Object, ByVal e As EventArgs)
If TreeView1.SelectedNode.Value = "" Then
' A folder is selected, so:
Exit Sub
Else
Dim iPath As String = TreeView1.SelectedNode.Value
If iPath = "0" Then
' The selected node is a folder so:
Exit Sub
Else
' Load the file:
IO.File.Open(iPath, IO.FileMode.Open)
'Shell(iPath, AppWinStyle.MaximizedFocus)
End If
End If
End Sub
(iPath is the full lenght path of the file that I want to load, including .xls)
I've tried: process.start(ipath), but I got an error message saying that process has not been declared.
I tried: Shell(iPath, AppWinStyle.MaximizedFocus) but I got an error message saying that the file does not exist, (but it does, I checked)
And last I tried: IO.File.Open(iPath, IO.FileMode.Open)
This doesn't crash or produce an error message, but it doesn't load the file either.
Can anyone help me?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|