Click here to Skip to main content
15,902,938 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Catch printing any document from any application (word, excel, pdf,...) to show printing options Pin
Steven J Jowett6-Oct-09 9:59
Steven J Jowett6-Oct-09 9:59 
QuestionDoes binding in design time automatically updating the field in the table in dataset? Pin
JUNEYT6-Oct-09 3:54
JUNEYT6-Oct-09 3:54 
AnswerRe: Does binding in design time automatically updating the field in the table in dataset? Pin
Dave Kreskowiak6-Oct-09 8:02
mveDave Kreskowiak6-Oct-09 8:02 
QuestionScriptlet control Pin
mmusha6-Oct-09 1:11
mmusha6-Oct-09 1:11 
AnswerRe: Scriptlet control Pin
Dave Kreskowiak6-Oct-09 4:04
mveDave Kreskowiak6-Oct-09 4:04 
GeneralRe: Scriptlet control Pin
mmusha6-Oct-09 21:03
mmusha6-Oct-09 21:03 
AnswerRe: Scriptlet control Pin
The Man from U.N.C.L.E.6-Oct-09 4:12
The Man from U.N.C.L.E.6-Oct-09 4:12 
QuestionWinform UploadFile to Upload.aspx page (VB.Net 2005) Pin
S.Dhanasekaran6-Oct-09 0:00
S.Dhanasekaran6-Oct-09 0:00 
Hi All,

I need some help with customizing an upload.aspx. I have a VB.Net 2005
Winform that has a file picker and a textbox (plus loads of other stuff).
When the user selects a file, I want to upload the file to a server.

This is the command I am using in my Winform to upload the file:

My.Computer.Network.UploadFile(CStr(e.Value), Files_Dir, "user", "password",
True, 100, FileIO.UICancelOption.ThrowException)

Where Files_dir = http://server/upload.aspx

Separately, I've created an upload.aspx page that works fine. When I select
a file or type a filename into the textbox on the upload.aspx page and click
upload, the file is uploaded to the correct directory on the server.

The upload.aspx form is simple with just one textbox and 2 buttons:

<%@ 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-transition al.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Upload</title>
</head>
<body>
<form id="frmUp" runat="server">
<div>
<input id="inpFile" type="file" runat="server" /><br/>
<asp:Button id="btn_Upload" runat="server" text="Upload" /><br
/>
<span id="txtMsg" runat="server" />
</div>
</form>
</body>
</html>

And the code behind:

Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btn_Upload.Click
Dim i As Integer
Dim objFile As HttpPostedFile
Dim strFileName As String
Dim strMessage As String = ""

For i = 0 To Request.Files.Count - 1
objFile = Request.Files(i)
If Len(objFile.FileName) > 0 Then
strFileName objFile.FileName.Substring(objFile.FileName.LastInd exOf("\") + 1)
Try
objFile.SaveAs(Server.MapPath("~/Files") & "/" &
strFileName)
strMessage &= "<span>" & strFileName & " successfully
uploaded</span><br/>"
Catch ex As Exception
strMessage &= "<span>Failed uploading " & strFileName &
": " & ex.ToString() & "</span><br/>"
End Try
End If
Next i

txtMsg.InnerHtml = strMessage
End Sub

So, how do I pass the filename to be uploaded to the upload.aspx page?
(Something like http://server/upload.aspx?filename)??? I know the code
that's in the button click event will work when someone actually clicks the
button, but where do I put the code so that it'll fire when the winform
tries to upload a file? (It seems that the page load event might be ok, but,
is the page ever loaded?)

I don't want the Winform user to ever see the upload.aspx page. I just want
the Winform UploadFile command to use the form to put the file on the
server.

Any help would be greatly appreciated!!
AnswerRe: Winform UploadFile to Upload.aspx page (VB.Net 2005) Pin
Christian Graus6-Oct-09 0:12
protectorChristian Graus6-Oct-09 0:12 
Questionout prameter to store procedure in vb.net Pin
paya1pa5-Oct-09 22:06
paya1pa5-Oct-09 22:06 
AnswerRe: out prameter to store procedure in vb.net Pin
εїзεїзεїз5-Oct-09 23:44
εїзεїзεїз5-Oct-09 23:44 
GeneralRe: out prameter to store procedure in vb.net Pin
Christian Graus5-Oct-09 23:58
protectorChristian Graus5-Oct-09 23:58 
GeneralRe: out prameter to store procedure in vb.net Pin
εїзεїзεїз6-Oct-09 0:04
εїзεїзεїз6-Oct-09 0:04 
AnswerRe: out prameter to store procedure in vb.net Pin
Christian Graus6-Oct-09 0:02
protectorChristian Graus6-Oct-09 0:02 
GeneralRe: out prameter to store procedure in vb.net Pin
εїзεїзεїз6-Oct-09 0:14
εїзεїзεїз6-Oct-09 0:14 
QuestionGetting the pid(process id) in vb.net when a task is scheduled or Run Pin
balaji sukumaran5-Oct-09 20:23
balaji sukumaran5-Oct-09 20:23 
AnswerRe: Getting the pid(process id) in vb.net when a task is scheduled or Run Pin
Christian Graus5-Oct-09 20:34
protectorChristian Graus5-Oct-09 20:34 
QuestionByte Array and Listview Display on large icon, small icon, list and tile view Pin
Danang Prakoso5-Oct-09 16:29
Danang Prakoso5-Oct-09 16:29 
GeneralRe: Byte Array and Listview Display on large icon, small icon, list and tile view Pin
Danang Prakoso5-Oct-09 16:30
Danang Prakoso5-Oct-09 16:30 
AnswerRe: Byte Array and Listview Display on large icon, small icon, list and tile view Pin
Richard MacCutchan6-Oct-09 0:18
mveRichard MacCutchan6-Oct-09 0:18 
QuestionRe: Byte Array and Listview Display on large icon, small icon, list and tile view Pin
Danang Prakoso6-Oct-09 16:13
Danang Prakoso6-Oct-09 16:13 
AnswerRe: Byte Array and Listview Display on large icon, small icon, list and tile view Pin
Richard MacCutchan6-Oct-09 21:36
mveRichard MacCutchan6-Oct-09 21:36 
QuestionRe: Byte Array and Listview Display on large icon, small icon, list and tile view Pin
Danang Prakoso12-Oct-09 17:10
Danang Prakoso12-Oct-09 17:10 
AnswerRe: Byte Array and Listview Display on large icon, small icon, list and tile view Pin
Richard MacCutchan12-Oct-09 22:09
mveRichard MacCutchan12-Oct-09 22:09 
QuestionRe: Byte Array and Listview Display on large icon, small icon, list and tile view Pin
Danang Prakoso13-Oct-09 17:12
Danang Prakoso13-Oct-09 17:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.